You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Jeff Zhang <zj...@gmail.com> on 2019/04/02 09:08:08 UTC

Unable to use default as database name

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

Re: Unable to use default as database name

Posted by YuZhao Chen <yu...@gmail.com>.
Calcite's parser use JavaCC and the built in keywords are configured
hard-code, so there is no way to change this. An quote character may be a
better choice.

Jeff Zhang <zj...@gmail.com>于2019年4月2日 周二下午9:15写道:

> Thanks Amit. I'd like to keep my system compatible with hive sql, but
> unfortunately hive use default as its default database name. Is there any
> way to customize calcite's parser to allow user to use default ?
>
> Amit Weitzner <am...@wpsemantix.com> 于2019年4月2日周二 下午6:36写道:
>
> > 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 <zj...@gmail.com> 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
> > >
> >
>
>
> --
> Best Regards
>
> Jeff Zhang
>

Re: Unable to use default as database name

Posted by Jeff Zhang <zj...@gmail.com>.
Thanks Amit. I'd like to keep my system compatible with hive sql, but
unfortunately hive use default as its default database name. Is there any
way to customize calcite's parser to allow user to use default ?

Amit Weitzner <am...@wpsemantix.com> 于2019年4月2日周二 下午6:36写道:

> 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 <zj...@gmail.com> 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
> >
>


-- 
Best Regards

Jeff Zhang

Re: Unable to use default as database name

Posted by Amit Weitzner <am...@wpsemantix.com>.
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 <zj...@gmail.com> 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
>