Not able use PostgresDialect.

2020-02-12 Thread Shivraj Singh
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()

Re: Not able use PostgresDialect.

2020-02-13 Thread Danny Chan
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 于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 excep

Re: Not able use PostgresDialect.

2020-02-13 Thread Julian Hyde
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 Calc

Re: Not able use PostgresDialect.

2020-02-13 Thread Shivraj Singh
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()

Re: Not able use PostgresDialect.

2020-02-13 Thread Danny Chan
You should extend the babel parser by yourself. Shivraj Singh 于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) >

Re: Not able use PostgresDialect.

2020-02-13 Thread Shivraj Singh
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. +91-8800782123 Canada - USA - India - Singapore

Re: Not able use PostgresDialect.

2020-02-14 Thread Stamatis Zampetakis
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 wrote: > Thanks @Danny Chan , > > Please tell me one more thing: > J

Re: Not able use PostgresDialect.

2020-02-14 Thread Danny Chan
The XXXDialect is used for translating the Calcite RelNode tree to normal sql text that is used in the JDBC connection to external engines, so it is actually “unparsing”, what you need is parsing sql text to RelNode. Best, Danny Chan 在 2020年2月14日 +0800 PM3:58,Shivraj Singh ,写道: > Thanks @Danny C

Re: Not able use PostgresDialect.

2020-02-18 Thread Shivraj Singh
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. +91-8800782123 Canada - USA - India - Singapore

Re: Not able use PostgresDialect.

2020-02-18 Thread Shivraj Singh
Thanks, @Danny Chan, need little more help like I am using calcite-babel for parsing the query: I have a sql query: *select * from my_table1 dwm INNER JOIN my_table2 wl ON (dwm.id = wl.id ) where dwm.time - 'timeinterval'::interval* and this is my config for using BA