Hi Jeff,

"default" is a reserved keyword in calcite parser.

If you'll add quoting to default it will work:
select * from "default".table_1
select * from `default`.table_1

The quotation marks depend on your configuration in the calcite parser (the
default is ").

Hope this helps,
Amit


On Tue, Apr 2, 2019 at 12:08 PM Jeff Zhang <[email protected]> wrote:

> Hi Folks,
>
> I try to integrate calcite into our product, and found that I can not use
> default as the database name. (select * from default.table_1)
>
> I will hit the following error. Is there any way that I can use default as
> database name ? Thanks
>
> org.apache.calcite.sql.parser.SqlParseException: Encountered "from default"
> at line 1, column 10.
> Was expecting one of:
>     <EOF>
>     "ORDER" ...
>     "LIMIT" ...
>     "OFFSET" ...
>     "FETCH" ...
>     "FROM" <IDENTIFIER> ...
>     "FROM" <QUOTED_IDENTIFIER> ...
>     "FROM" <BACK_QUOTED_IDENTIFIER> ...
>     "FROM" <BRACKET_QUOTED_IDENTIFIER> ...
>     "FROM" <UNICODE_QUOTED_IDENTIFIER> ...
>     "FROM" "LATERAL" ...
>     "FROM" "(" ...
>     "FROM" "UNNEST" ...
>     "FROM" "TABLE" ...
>     "," ...
>     "AS" ...
>     <IDENTIFIER> ...
>     <QUOTED_IDENTIFIER> ...
>     <BACK_QUOTED_IDENTIFIER> ...
>     <BRACKET_QUOTED_IDENTIFIER> ...
>     <UNICODE_QUOTED_IDENTIFIER> ...
>     "UNION" ...
>     "INTERSECT" ...
>     "EXCEPT" ...
>     "MINUS" ...
>
>
> at
>
> org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:355)
> at
>
> org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:143)
> at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:156)
>
> --
> Best Regards
>
> Jeff Zhang
>

Reply via email to