cloud-fan commented on code in PR #47272:
URL: https://github.com/apache/spark/pull/47272#discussion_r1681166326
##########
sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4:
##########
@@ -251,26 +258,29 @@ statement
| (MSCK)? REPAIR TABLE identifierReference
(option=(ADD|DROP|SYNC) PARTITIONS)?
#repairTable
| op=(ADD | LIST) identifier .*?
#manageResource
- | SET COLLATION collationName=identifier
#setCollation
- | SET ROLE .*?
#failNativeCommand
+ | CREATE INDEX (IF errorCapturingNot EXISTS)? identifier ON TABLE?
+ identifierReference (USING indexType=identifier)?
+ LEFT_PAREN columns=multipartIdentifierPropertyList RIGHT_PAREN
+ (OPTIONS options=propertyList)?
#createIndex
+ | DROP INDEX (IF EXISTS)? identifier ON TABLE? identifierReference
#dropIndex
+ | unsupportedHiveNativeCommands .*?
#failNativeCommand
+ ;
+
+setResetStatement
+ : SET COLLATION collationName=identifier
#setCollation
+ | SET ROLE .*?
#failSetRole
| SET TIME ZONE interval
#setTimeZone
| SET TIME ZONE timezone
#setTimeZone
| SET TIME ZONE .*?
#setTimeZone
| SET (VARIABLE | VAR) assignmentList
#setVariable
| SET (VARIABLE | VAR) LEFT_PAREN multipartIdentifierList RIGHT_PAREN EQ
- LEFT_PAREN query RIGHT_PAREN
#setVariable
+ LEFT_PAREN query RIGHT_PAREN
#setVariable
Review Comment:
I prefer the first option as it's more explicit. For example I missed this
subtle difference in the ANTLR rules.
The code structure can be
```
setVariable
: SET (VARIABLE | VAR)? assignmentList
| ...
compoundStatement
: statement
| setVariable
| ...
setResetStatement
: ...
| setVariable
| ...
```
--
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]