davidm-db commented on code in PR #47423:
URL: https://github.com/apache/spark/pull/47423#discussion_r1713636436
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -136,8 +139,22 @@ class AstBuilder extends DataTypeAstBuilder
label: Option[String],
allowVarDeclare: Boolean): CompoundBody = {
val buff = ListBuffer[CompoundPlanStatement]()
+ val handlers = ListBuffer[ErrorHandler]()
+ val conditions = mutable.HashMap[String, String]()
+ val sqlStates = mutable.Set[String]()
+
ctx.compoundStatements.forEach(compoundStatement => {
- buff += visit(compoundStatement).asInstanceOf[CompoundPlanStatement]
+ val stmt = visit(compoundStatement).asInstanceOf[CompoundPlanStatement]
+
+ stmt match {
+ case handler: ErrorHandler => handlers += handler
+ case condition: ErrorCondition =>
+ assert(!conditions.contains(condition.conditionName)) // Check for
duplicate names.
+ assert(!sqlStates.contains(condition.value)) // Check for
duplicate sqlStates.
Review Comment:
should these be asserts or exception throws? this seems like an user 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: [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]