You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/04/17 14:05:45 UTC
[GitHub] [calcite] chunweilei commented on a change in pull request #783:
[CALCITE-2453] Adding support of SQL statements separated by a semicolon
chunweilei commented on a change in pull request #783: [CALCITE-2453] Adding support of SQL statements separated by a semicolon
URL: https://github.com/apache/calcite/pull/783#discussion_r276258448
##########
File path: core/src/main/codegen/templates/Parser.jj
##########
@@ -937,6 +942,45 @@ SqlNode SqlQueryEof() :
{ return query; }
}
+/**
+ * Parses a list of SQL statements separated by semicolon.
+ * The semicolon is required between statements, but is
+ * optional at the end.
+ */
+SqlNodeList SqlStmtList() :
+{
+ final List<SqlNode> stmtList = new ArrayList<SqlNode>();
+ SqlNode stmt;
+}
+{
+ stmt = SqlStmtWithSemiColon() {
+ stmtList.add(stmt);
+ }
Review comment:
I run the test and I find that It will throw exception no matter with or without this PR as follows:
```
org.apache.calcite.sql.parser.SqlParseException: Encountered "SELECT" at line 1, column 19.
Was expecting one of:
<EOF>
"ORDER" ...
...
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.calcite.sql.parser.impl.ParseException: Encountered "SELECT" at line 1, column 19.
Was expecting one of:
<EOF>
...
at org.apache.calcite.sql.parser.impl.SqlParserImpl.generateParseException(SqlParserImpl.java:23129)
at org.apache.calcite.sql.parser.impl.SqlParserImpl.jj_consume_token(SqlParserImpl.java:22946)
at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlStmtEof(SqlParserImpl.java:914)
at org.apache.calcite.sql.parser.impl.SqlParserImpl.parseSqlStmtEof(SqlParserImpl.java:184)
at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:148)
... 28 more
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services