miland-db commented on code in PR #53271:
URL: https://github.com/apache/spark/pull/53271#discussion_r2578077239
##########
sql/core/src/test/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionSuite.scala:
##########
@@ -1323,6 +1323,89 @@ class SqlScriptingExecutionSuite extends QueryTest with
SharedSparkSession {
verifySqlScriptResult(sqlScript, expected = expected)
}
+ test("exit handler body without BEGIN-END propagates error properly") {
+ val sqlScript =
+ """
+ |BEGIN
+ | DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ | INSERT INTO test_table_non_existing VALUES(1, 2, 3);
+ |
+ | SELECT 1/0;
+ |END
+ |""".stripMargin
+ val exception = intercept[AnalysisException] {
+ verifySqlScriptResult(sqlScript, Seq.empty)
+ }
+ checkError(
+ exception = exception,
+ condition = "TABLE_OR_VIEW_NOT_FOUND",
+ sqlState = Some("42P01"),
+ parameters = Map("relationName" -> toSQLId("test_table_non_existing")),
+ context = ExpectedContext(
+ fragment = "test_table_non_existing",
+ start = 63,
+ stop = 85)
+ )
+ }
+
+ test("continue handler body without BEGIN-END propagates error properly") {
Review Comment:
Yes.
--
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]