davidm-db commented on code in PR #49726:
URL: https://github.com/apache/spark/pull/49726#discussion_r1946337253
##########
sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4:
##########
@@ -65,6 +65,7 @@ compoundStatement
| beginEndCompoundBlock
| declareConditionStatement
Review Comment:
[Can be done in a follow-up]
We should fix the `DECLARE CONDITION` statement. The simple case when we
declare an "empty" condition, like `DECLARE cond CONDITION;` fails currently -
`CONDITION` is recognized as a type and an exception is thrown that the type is
not recognized.
I think the simplest (and best) way to do this is to reorder the parser
rules and add a comment that `declareConditionStatement` needs to go before
`statement`. I think the parser already relies on the rules order in multiple
places and that this should be fine. So, I think we should go with this
approach, but add a comment in a PR description about other possible approaches
that we discussed offline.
Let's add the tests for this case as well.
--
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]