cloud-fan commented on code in PR #41007:
URL: https://github.com/apache/spark/pull/41007#discussion_r1195149964


##########
sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4:
##########
@@ -434,17 +434,31 @@ resource
 dmlStatementNoWith
     : insertInto query                                                         
    #singleInsertQuery
     | fromClause multiInsertQueryBody+                                         
    #multiInsertQuery
-    | DELETE FROM multipartIdentifier tableAlias whereClause?                  
    #deleteFromTable
-    | UPDATE multipartIdentifier tableAlias setClause whereClause?             
    #updateTable
-    | MERGE INTO target=multipartIdentifier targetAlias=tableAlias
-        USING (source=multipartIdentifier |
+    | DELETE FROM tableReference tableAlias whereClause?                       
    #deleteFromTable
+    | UPDATE tableReference tableAlias setClause whereClause?                  
    #updateTable
+    | MERGE INTO target=tableReference targetAlias=tableAlias
+        USING (source=tableReference |
           LEFT_PAREN sourceQuery=query RIGHT_PAREN) sourceAlias=tableAlias
         ON mergeCondition=booleanExpression
         matchedClause*
         notMatchedClause*
         notMatchedBySourceClause*                                              
    #mergeIntoTable
     ;
 
+tableReference
+    : IDENTIFIER_KW LEFT_PAREN expression RIGHT_PAREN
+    | multipartIdentifier
+    ;
+
+identifierReference
+    : IDENTIFIER_KW LEFT_PAREN expression RIGHT_PAREN
+    | multipartIdentifier
+    ;
+identifierReferenceAllowTemp

Review Comment:
   Or we can ask the caller side (e.g. the parser of CREATE TABLE command) to 
create the proper identifier logical plan, but I think using antlr rules to 
track the context is simpler.
   
   BTW I think we can still have a `multipartIdentifierOrClause` to avoid 
duplicated code.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to