dilipbiswal commented on a change in pull request #24150: [SPARK-27209][SQL]
Split parsing of SELECT and INSERT into two top-level rules in the grammar file.
URL: https://github.com/apache/spark/pull/24150#discussion_r267334609
##########
File path:
sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
##########
@@ -354,9 +355,14 @@ resource
: identifier STRING
;
+insertStatement
+ : (ctes)? insertInto queryTerm queryOrganization
#singleInsertQuery
+ | (ctes)? fromClause multiInsertQueryBody+
#multiInsertQuery
Review comment:
@cloud-fan did you mean make insertInto non-optional in
`multiInsertQueryBody` ? If so, i did try it and we need it to be optional to
parse statement referenced in
[test](https://github.com/apache/spark/blob/1b9fd67904671ea08526bfb7a97d694815d47665/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala#L133-L135)
Also , we we can have a mixture of insert and selects in the
multiInsertQueryBody. Thats why we have it under a "multi insert" rule where
insert is optional. Not sure, but i think `multiStatementBody` may be a better
name for the rule.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]