You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Dilip Raj Baral <di...@diliprajbaral.com> on 2018/12/16 09:49:14 UTC

Can’t seem to parse DDL staements

Hi, team.

I have been using Apache Calcite for about two weeks now for one of the projects at my company. I have found it fun and pretty useful so far. I have been able to parse DMLs very smoothly. However, when I tried to parse DDLs like CREATE TABLE, ALTER TABLE, etc., the SqlParser.parseStmt() or SqlParser.parseQuery() failed.

I have detailed the specifics in the following SO question.

https://stackoverflow.com/questions/53801005/apache-calcite-cant-seem-to-parse-ddl-statements

Looking forward to a suggestion.

Best regards,
Dilip Raj Baral
https://diliprajbaral.com



Re: Can’t seem to parse DDL staements

Posted by Michael Mior <mm...@apache.org>.
Support for some DDL is missing. See for example
https://issues.apache.org/jira/browse/CALCITE-2663


--
Michael Mior
mmior@apache.org


Le lun. 17 déc. 2018 à 15:40, Dilip Raj Baral <ra...@gmail.com> a
écrit :

> Hi, Ted.
>
> Thanks for the information. That was very helpful. I was not aware of
> calcite-server sub project.
>
> Also, on a quick look I found missing support for TRUNCATE TABLE, CREATE
> PROCEDURE and CREATE FUNCTION? Are they not available for real of am I
> missing something?
>
>
> On 17 December 2018 at 11:35:19 AM, Ted Xu (frankxus@gmail.com) wrote:
>
> Hi Dilip,
>
> DDL related code including statement parse and data structures are located
> in calcite-server sub-project.
>
> The unit test 'ServerParserTest' may be a good starting point to look into.
> You can find it here
>
> https://github.com/apache/calcite/blob/master/server/src/test/java/org/apache/calcite/test/ServerParserTest.java
>  .
>
> On Mon, Dec 17, 2018 at 1:34 AM Dilip Raj Baral <di...@diliprajbaral.com>
> wrote:
>
> > Hi, team.
> >
> > I have been using Apache Calcite for about two weeks now for one of the
> > projects at my company. I have found it fun and pretty useful so far. I
> > have been able to parse DMLs very smoothly. However, when I tried to
> parse
> > DDLs like CREATE TABLE, ALTER TABLE, etc., the SqlParser.parseStmt() or
> > SqlParser.parseQuery() failed.
> >
> > I have detailed the specifics in the following SO question.
> >
> >
> >
> https://stackoverflow.com/questions/53801005/apache-calcite-cant-seem-to-parse-ddl-statements
> >
> > Looking forward to a suggestion.
> >
> > Best regards,
> > Dilip Raj Baral
> > https://diliprajbaral.com
> >
> >
> >
>

Re: Can’t seem to parse DDL staements

Posted by Dilip Raj Baral <ra...@gmail.com>.
Hi, Ted.

Thanks for the information. That was very helpful. I was not aware of
calcite-server sub project.

Also, on a quick look I found missing support for TRUNCATE TABLE, CREATE
PROCEDURE and CREATE FUNCTION? Are they not available for real of am I
missing something?


On 17 December 2018 at 11:35:19 AM, Ted Xu (frankxus@gmail.com) wrote:

Hi Dilip,

DDL related code including statement parse and data structures are located
in calcite-server sub-project.

The unit test 'ServerParserTest' may be a good starting point to look into.
You can find it here
https://github.com/apache/calcite/blob/master/server/src/test/java/org/apache/calcite/test/ServerParserTest.java
 .

On Mon, Dec 17, 2018 at 1:34 AM Dilip Raj Baral <di...@diliprajbaral.com>
wrote:

> Hi, team.
>
> I have been using Apache Calcite for about two weeks now for one of the
> projects at my company. I have found it fun and pretty useful so far. I
> have been able to parse DMLs very smoothly. However, when I tried to parse
> DDLs like CREATE TABLE, ALTER TABLE, etc., the SqlParser.parseStmt() or
> SqlParser.parseQuery() failed.
>
> I have detailed the specifics in the following SO question.
>
>
> https://stackoverflow.com/questions/53801005/apache-calcite-cant-seem-to-parse-ddl-statements
>
> Looking forward to a suggestion.
>
> Best regards,
> Dilip Raj Baral
> https://diliprajbaral.com
>
>
>

Re: Can’t seem to parse DDL staements

Posted by Ted Xu <fr...@gmail.com>.
Hi Dilip,

DDL related code including statement parse and data structures are located
in calcite-server sub-project.

The unit test 'ServerParserTest' may be a good starting point to look into.
You can find it here
https://github.com/apache/calcite/blob/master/server/src/test/java/org/apache/calcite/test/ServerParserTest.java
 .

On Mon, Dec 17, 2018 at 1:34 AM Dilip Raj Baral <di...@diliprajbaral.com>
wrote:

> Hi, team.
>
> I have been using Apache Calcite for about two weeks now for one of the
> projects at my company. I have found it fun and pretty useful so far. I
> have been able to parse DMLs very smoothly. However, when I tried to parse
> DDLs like CREATE TABLE, ALTER TABLE, etc., the SqlParser.parseStmt() or
> SqlParser.parseQuery() failed.
>
> I have detailed the specifics in the following SO question.
>
>
> https://stackoverflow.com/questions/53801005/apache-calcite-cant-seem-to-parse-ddl-statements
>
> Looking forward to a suggestion.
>
> Best regards,
> Dilip Raj Baral
> https://diliprajbaral.com
>
>
>

回复:Can’t seem to parse DDL staements

Posted by ‘-常心-’ <12...@qq.com>.
Can use calcite-server parse DDLs, code :


SqlParser.Config sqlParserConfig = SqlParser.configBuilder()
        .setConformance(SqlConformanceEnum.MYSQL_5)
        .setLex(Lex.MYSQL)
        .build(); 
InputStream  inputStream = new ByteArrayInputStream(query.getBytes());
SqlDdlParserImpl parser = new SqlDdlParserImpl(inputStream);
parser.setConformance(parserConfig.conformance());
parser.setIdentifierMaxLength(parserConfig.identifierMaxLength());
parser.setQuotedCasing(parserConfig.quotedCasing());
parser.setUnquotedCasing(parserConfig.unquotedCasing());
SqlNode  sqlNode = parser.parseSqlStmtEof();






------------------ 原始邮件 ------------------
发件人: "Dilip Raj Baral"<di...@diliprajbaral.com>;
发送时间: 2018年12月16日(星期天) 晚上6:19
收件人: "dev"<de...@calcite.apache.org>;
抄送: "Dilip Raj Baral"<ra...@gmail.com>; 
主题: Can’t seem to parse DDL staements



Hi, team.

I have been using Apache Calcite for about two weeks now for one of the projects at my company. I have found it fun and pretty useful so far. I have been able to parse DMLs very smoothly. However, when I tried to parse DDLs like CREATE TABLE, ALTER TABLE, etc., the SqlParser.parseStmt() or SqlParser.parseQuery() failed.

I have detailed the specifics in the following SO question.

https://stackoverflow.com/questions/53801005/apache-calcite-cant-seem-to-parse-ddl-statements

Looking forward to a suggestion.

Best regards,
Dilip Raj Baral
https://diliprajbaral.com