davidm-db commented on code in PR #49726:
URL: https://github.com/apache/spark/pull/49726#discussion_r1946340313


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -329,6 +365,23 @@ class AstBuilder extends DataTypeAstBuilder
               .duplicateConditionInScope(CurrentOrigin.get, 
condition.conditionName)
           }
           conditions += condition.conditionName -> condition.sqlState
+        case signalStatement: SignalStatement if 
signalStatement.sqlState.isEmpty =>
+          // Try to get sqlState if condition is user defined.
+          signalStatement.sqlState = 
conditions.get(signalStatement.errorCondition.get)
+
+          // If condition is not user defined, check if it is a spark defined 
error condition.
+          if (signalStatement.sqlState.isEmpty) {

Review Comment:
   Also, a small comment explaining why we have this logic of filling in 
`sqlState` here would be nice.



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

Reply via email to