-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP][SPARK-48353][SQL] Introduction of Error Handling mechanism in SQL Scripting #47423
base: master
Are you sure you want to change the base?
[WIP][SPARK-48353][SQL] Introduction of Error Handling mechanism in SQL Scripting #47423
Conversation
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingInterpreter.scala
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingInterpreter.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala
Show resolved
Hide resolved
# Conflicts: # sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala # sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingInterpreter.scala # sql/core/src/test/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNodeSuite.scala # sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/ThriftServerWithSparkContextSuite.scala
sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseLexer.g4
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingInterpreter.scala
Outdated
Show resolved
Hide resolved
# Conflicts: # sql/core/src/test/scala/org/apache/spark/sql/scripting/SqlScriptingInterpreterSuite.scala
@@ -119,11 +120,13 @@ class AstBuilder extends DataTypeAstBuilder | |||
override def visitCompoundOrSingleStatement( | |||
ctx: CompoundOrSingleStatementContext): CompoundBody = withOrigin(ctx) { | |||
Option(ctx.singleCompoundStatement()).map { s => | |||
if (!SQLConf.get.sqlScriptingEnabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you get the current config value from the active config obj conf
? See other examples in the same file like conf.getConf(SQLConf.ENABLE_DEFAULT_COLUMNS)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be rebased on: #47609. Can you please leave comments there first, and then we can get back to this one.
origin = origin, | ||
errorClass = "UNSUPPORTED_FEATURE.SQL_SCRIPTING_NOT_ENABLED", | ||
cause = null, | ||
messageParameters = Map("sqlScriptingEnabled" -> SQLConf.SQL_SCRIPTING_ENABLED.key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, follow the existing convention and quote the SQL config name using toSQLConf()
@@ -269,7 +269,7 @@ org.apache.spark.sql.catalyst.parser.ParseException | |||
"errorClass" : "PARSE_SYNTAX_ERROR", | |||
"sqlState" : "42601", | |||
"messageParameters" : { | |||
"error" : "'.'", | |||
"error" : "end of input", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why this PR changes this error parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check this one
What changes were proposed in this pull request?
This pull request introduces the logic of error handling inside SQL Scripting language. Now, it is possible to:
Why are the changes needed?
The intent is to add the possibility for user to handle SQL errors in a custom defined way..
Does this PR introduce any user-facing change?
No.
How was this patch tested?
There are already existing test suites for SQL scripting that have been improved to test new functionalities:
SqlScriptingParserSuite
SqlScriptingExecutionNodeSuite
SqlScriptingInterpreterSuite
Was this patch authored or co-authored using generative AI tooling?
No.
Additional changes:
Added
cleanup
method insideCompoundBody
to handle premature exit. Currently this can happen while executingleave
statement.NEED TO FIX (follow-up work):