You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2023/05/16 13:16:15 UTC

[GitHub] [spark] cloud-fan commented on a diff in pull request #41007: [WIP][SPARK-43205] IDENTIFIER clause

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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org