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_r267954314
 
 

 ##########
 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 Currently after this change, fromClause and multiple 
querySpecification queryOrganization will be handled by 2nd alternative of the 
insertStatement. I know that this may look confusing. In this pass, i wanted to 
handle single queries in one rule which is `query`. This would help us catch 
quite a few errors i.e when a user could plugin an insert in any part of the 
query. The rest is currently handled by `insertStatement` which includes multi 
insert, multi select and multi insert + select etc.  Please let me know what 
you think.  

----------------------------------------------------------------
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]

Reply via email to