srielau commented on code in PR #47614:
URL: https://github.com/apache/spark/pull/47614#discussion_r1714831579


##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -1534,6 +1534,24 @@
     ],
     "sqlState" : "42601"
   },
+  "IDENTITY_COLUMNS_DUPLICATED_DESCRIPTOR" : {
+    "message" : [
+      "Duplicated IDENTITY column descriptor: <descriptor>."

Review Comment:
   What's a "descriptor"? Are we exposing interals to SQL here?



##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -1534,6 +1534,24 @@
     ],
     "sqlState" : "42601"
   },
+  "IDENTITY_COLUMNS_DUPLICATED_DESCRIPTOR" : {
+    "message" : [
+      "Duplicated IDENTITY column descriptor: <descriptor>."
+    ],
+    "sqlState" : "42734"

Review Comment:
   This state is quite specific to "column level" object names.
   42601 should do here
   



##########
sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4:
##########
@@ -1267,7 +1267,22 @@ colDefinitionOption
     ;
 
 generationExpression
-    : GENERATED ALWAYS AS LEFT_PAREN expression RIGHT_PAREN
+    : GENERATED ALWAYS AS LEFT_PAREN expression RIGHT_PAREN     
#generatedColumn
+    | GENERATED (ALWAYS | BY DEFAULT) AS IDENTITY identityColSpec? 
#identityColumn
+    ;
+
+identityColSpec
+    : LEFT_PAREN identityColSpecOption* RIGHT_PAREN
+    ;
+
+identityColSpecOption
+    : START WITH start=identityStartOrStep
+    | INCREMENT BY step=identityStartOrStep
+    ;
+
+identityStartOrStep
+    : MINUS? INTEGER_VALUE
+    | MINUS? BIGINT_LITERAL

Review Comment:
   W don't have a generic primitive for integral literals?



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