Thanks, @Stamatis Zampetakis, SqlBabelParserImpl where I can find this
class. and what config I have to set for BABEL parser.
*Shivraj Singh*
Software Consultant
Knoldus Inc. <http://www.knoldus.com>
+91-8800782123
Canada - USA - India - Singapore
<https://in.linkedin.com/company/knoldus> <https://twitter.com/Knolspeak>
<https://www.facebook.com/KnoldusSoftware/> <https://blog.knoldus.com/>


On Fri, Feb 14, 2020 at 1:39 PM Stamatis Zampetakis <[email protected]>
wrote:

> Hi Shivraj,
>
> In order to use the Babel parser you also need to set the appropriate
> factory.
>
> .setParserFactory(SqlBabelParserImpl.FACTORY) not SqlParserImpl.FACTORY
>
> Best,
> Stamatis
>
>
> On Fri, Feb 14, 2020 at 8:58 AM Shivraj Singh <[email protected]>
> wrote:
>
> > Thanks @Danny Chan ,
> >
> > Please tell me one more thing:
> > Just curious what does the PostgresSqlDialect accomplish in Calcite, if
> not
> > to parse postgres sqls?
> > *Shivraj Singh*
> > Software Consultant
> > Knoldus Inc. <http://www.knoldus.com>
> > +91-8800782123
> > Canada - USA - India - Singapore
> > <https://in.linkedin.com/company/knoldus> <https://twitter.com/Knolspeak
> >
> > <https://www.facebook.com/KnoldusSoftware/> <https://blog.knoldus.com/>
> >
> >
> > On Fri, Feb 14, 2020 at 12:26 PM Danny Chan <[email protected]>
> wrote:
> >
> > > You should extend the babel parser by yourself.
> > >
> > > Shivraj Singh <[email protected]>于2020年2月14日 周五下午2:33写道:
> > >
> > > > I tried for BABEL conformance but it also doesn't work.
> > > > This is the way I used it:
> > > >
> > > >         val sqlParserConfig = SqlParser.configBuilder()
> > > >           .setParserFactory(SqlParserImpl.FACTORY)
> > > >           .setConformance(SqlConformanceEnum.BABEL)
> > > >           .setConfig(sqlParserA)
> > > >           .build()
> > > >
> > > >         SqlParser.create(new
> > > > SourceStringReader(sql),sqlParserConfig).parseQuery()
> > > >
> > > > Am I doing something wrong?
> > > >
> > > > *Shivraj Singh*
> > > > Software Consultant
> > > > Knoldus Inc. <http://www.knoldus.com>
> > > > +91-8800782123
> > > > Canada - USA - India - Singapore
> > > > <https://in.linkedin.com/company/knoldus> <
> > https://twitter.com/Knolspeak
> > > >
> > > > <https://www.facebook.com/KnoldusSoftware/> <
> https://blog.knoldus.com/
> > >
> > > >
> > > >
> > > > On Thu, Feb 13, 2020 at 11:42 PM Julian Hyde <[email protected]>
> wrote:
> > > >
> > > > > Note that Calcite's default parser only parses SQL in Calcite's
> > > > > dialect (with a little leeway such as choice of quoting
> characters).
> > > > >
> > > > > To parse other dialects, use the Babel parser. It can handle (or
> > could
> > > > > handle) SQL extensions that are not in standard SQL and which we
> > don't
> > > > > want to bring into Calcite SQL. PostgreSQL's "::" cast operator is
> an
> > > > > example of that.
> > > > >
> > > > > On Thu, Feb 13, 2020 at 4:00 AM Danny Chan <[email protected]>
> > > wrote:
> > > > > >
> > > > > > If you want to parse the sql in PostgreSQL dialect, there is no
> way
> > > to
> > > > do
> > > > > > that now. You need a new SqlConformance actually.
> > > > > >
> > > > > > Shivraj Singh <[email protected]>于2020年2月13日 周四下午3:50写道:
> > > > > >
> > > > > > > Hi, I want to parse the query of PostgreSQL via Calcite and
> > while I
> > > > am
> > > > > > > parsing the query using the calcite parser it gives me
> exception
> > > for
> > > > > system
> > > > > > > keyword.
> > > > > > >
> > > > > > > This is the program:
> > > > > > > This is the query :
> > > > > > > " select system from my_table;"
> > > > > > >
> > > > > > > val  parser:SqlParser = SqlParser.create(query)
> > > > > > > parser.parseQuery()
> > > > > > >
> > > > > > > Exception I got.
> > > > > > > org.apache.calcite.sql.parser.SqlParseException: Encountered
> > > > > "*system*" at
> > > > > > > line 1, column 8.
> > > > > > > Was expecting one of:
> > > > > > >     "ABS" ...
> > > > > > >     "ALL" ...
> > > > > > >
> > > > > > > And I also got exception for this scenario to :
> > > > > > > query :
> > > > > > > INSERT INTO my_table(id,system_state)
> > > > > > >  VALUES (?, ?::system_state_type)
> > > > > > >
> > > > > > > exception I got:
> > > > > > > org.apache.calcite.sql.parser.SqlParseException: Encountered
> > "*:*"
> > > at
> > > > > line.
> > > > > > > Was expecting one of:
> > > > > > >     <EOF>
> > > > > > >     "EXCEPT" ...
> > > > > > >
> > > > > > > Please help me
> > > > > > > 1. How to parse these queries?
> > > > > > > 2. Can we parse query using  PostgresqlSqlDialect, if yes then
> > how.
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > > *Shivraj Singh*
> > > > > > > Software Consultant
> > > > > > > Knoldus Inc. <http://www.knoldus.com>
> > > > > > > +91-8800782123
> > > > > > > Canada - USA - India - Singapore
> > > > > > > <https://in.linkedin.com/company/knoldus> <
> > > > > https://twitter.com/Knolspeak>
> > > > > > > <https://www.facebook.com/KnoldusSoftware/> <
> > > > https://blog.knoldus.com/
> > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to