You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (Jira)" <ji...@apache.org> on 2026/01/12 01:56:00 UTC
[jira] [Resolved] (SPARK-55005) CONTINUE handler not working properly when exception occurs inside loops
[ https://issues.apache.org/jira/browse/SPARK-55005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wenchen Fan resolved SPARK-55005.
---------------------------------
Fix Version/s: 4.2.0
4.1.1
Resolution: Fixed
Issue resolved by pull request 53759
[https://github.com/apache/spark/pull/53759]
> CONTINUE handler not working properly when exception occurs inside loops
> ------------------------------------------------------------------------
>
> Key: SPARK-55005
> URL: https://issues.apache.org/jira/browse/SPARK-55005
> Project: Spark
> Issue Type: Sub-task
> Components: Spark Core
> Affects Versions: 4.2.0
> Reporter: Milan Dankovic
> Assignee: Milan Dankovic
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.2.0, 4.1.1
>
>
> In the example below, after continue handler is executed, the whole loop will be skipped instead of continuing with iteration. The bug was introduced in this PR: [https://github.com/apache/spark/pull/52371], because the interruptConditionalStatements method in SqlScriptingExecution.scala was designed to skip conditional statements when exceptions occurred in their condition evaluation (e.g., WHILE 1/0 > 0). However, it didn't distinguish between:
> * Exception in condition → loop should be skipped
> * Exception in body → loop should continue iteration
> {code:java}
> BEGIN
> -- Multi-variable declaration (New in 4.1)
> DECLARE x, y = 1;
>
> -- Define error handling logic
> DECLARE CONTINUE HANDLER FOR DIVIDE_BY_ZERO
> BEGIN
> SET y = -1;
> END;
> -- Loop logic
> WHILE x < 8 DO
> SET x = x + 1;
> -- This might throw a divide-by-zero error, but the handler will catch it
> SET y = y / (x - 3);
> END WHILE;
> SELECT x, y;
> END;
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org