davidm-db commented on code in PR #49427:
URL: https://github.com/apache/spark/pull/49427#discussion_r1928398977
##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingInterpreter.scala:
##########
@@ -118,16 +125,44 @@ case class SqlScriptingInterpreter(session: SparkSession)
{
// For each condition handler is defined for, add corresponding key
value pair
// to the conditionHandlerMap.
- handler.conditions.foreach(condition => {
+ handler.handlerTriggers.conditions.foreach(condition => {
// Condition can either be the key in conditions map or SqlState.
if (conditionHandlerMap.contains(condition)) {
throw
SqlScriptingErrors.duplicateHandlerForSameCondition(CurrentOrigin.get,
condition)
} else {
- conditionHandlerMap.put(condition, handlerExec)
+ conditionHandlerMap.addOne(condition, handlerExec)
Review Comment:
nit: `addOne` -> `append`
##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingInterpreter.scala:
##########
@@ -118,16 +125,44 @@ case class SqlScriptingInterpreter(session: SparkSession)
{
// For each condition handler is defined for, add corresponding key
value pair
// to the conditionHandlerMap.
- handler.conditions.foreach(condition => {
+ handler.handlerTriggers.conditions.foreach(condition => {
// Condition can either be the key in conditions map or SqlState.
if (conditionHandlerMap.contains(condition)) {
throw
SqlScriptingErrors.duplicateHandlerForSameCondition(CurrentOrigin.get,
condition)
} else {
- conditionHandlerMap.put(condition, handlerExec)
+ conditionHandlerMap.addOne(condition, handlerExec)
}
})
+
+ // For each sqlState handler is defined for, add corresponding key value
pair
+ // to the sqlStateHandlerMap.
+ handler.handlerTriggers.sqlStates.foreach(sqlState => {
+ // Condition can either be the key in conditions map or SqlState.
+ if (sqlStateHandlerMap.contains(sqlState)) {
+ throw
SqlScriptingErrors.duplicateHandlerForSameCondition(CurrentOrigin.get, sqlState)
+ } else {
+ sqlStateHandlerMap.addOne(sqlState, handlerExec)
Review Comment:
nit: `addOne` -> `append`
--
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]