davidm-db commented on code in PR #49427: URL: https://github.com/apache/spark/pull/49427#discussion_r1920281642
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParserUtils.scala: ########## @@ -140,6 +143,93 @@ object ParserUtils extends SparkParserUtils { } } +class SqlScriptingParsingContext { + + sealed trait State + private object State { + case object INIT extends State + case object VARIABLES_AND_CONDITIONS extends State Review Comment: Awesome approach with the state machine! The only suggestion I have is to separate variables and conditions into two separate states. It would make state transitions just a bit more complex, but we would be able to expose more specific exceptions - now, we call `variableDeclarationOnlyAtBeginning` for both cases, but we should really create a different exceptions for variables and conditions. We can also improve the exception message a bit more, to a format more similar to the new `INVALID_HANDLER_DECLARATION` error. -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org