You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by 赵帅兵 <11...@qq.com> on 2019/07/22 09:56:20 UTC

How to parse multiple sql statements with Calcite

Hello there,


I want to know how to parse multiple statements in one string.
sqlparser.parseStmt() can only parse one statement.

For example, I have one string: "Create table tbl1(id bigint); Select * from tbl1;"

How to split the string to two SQL statements.

I expect to get a list of SqlNode.




Thanks.

Re: How to parse multiple sql statements with Calcite

Posted by Danny Chan <yu...@gmail.com>.
Hi,
You can just use the method #parseStmtlist[1] which is aimed for multiple sql statements.

[1] https://github.com/apache/calcite/blob/59c7acd802a885dec1db576974bea6e205d3d955/core/src/main/java/org/apache/calcite/sql/parser/SqlParser.java#L198

Best,
Danny Chan
在 2019年7月22日 +0800 PM11:07,赵帅兵 <11...@qq.com>,写道:
> Hello there,
>
>
> I want to know how to parse multiple statements in one string.
> sqlparser.parseStmt() can only parse one statement.
>
> For example, I have one string: "Create table tbl1(id bigint); Select * from tbl1;"
>
> How to split the string to two SQL statements.
>
> I expect to get a list of SqlNode.
>
>
>
>
> Thanks.