forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-48353][SQL] Introduction of Exception Handling mechanism in SQ…
…L Scripting ### 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: - declare conditions for specific SQL States (currently only valid in scope where they are defined) - declare handlers to catch and process errors that are risen during statement execution Rules for selecting the most appropriate handler: - Named condition handlers are most specific. - SQLSTATE handlers are next in specificity. - Generic NOT FOUND and SQLEXCEPTION handlers are least specific. Note: Handlers defined in the innermost compound statement where the exception was raised are considered. ### Why are the changes needed? The intent is to add the possibility for user to handle SQL errors in a custom defined way. ### Limitations - Currently, only `EXIT` handler is supported. Support for `CONTINUE` handlers will come in the future. - It is only possible to declare condition in its full form by specifying SQLSTATE. Short form with default SQLSTATE is not yet supported. ### 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` - `SqlScriptingExecutionSuite` - `SqlScriptingE2eSuite` ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#49427 from miland-db/milan-dankovic_data/refactor-execution-4-condition-handlers. Authored-by: Milan Dankovic <milan.dankovic@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
- Loading branch information
Showing
22 changed files
with
2,069 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.