You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "miland-db (via GitHub)" <gi...@apache.org> on 2026/01/21 20:30:45 UTC
[PR] [SQL][SCRIPTING] Fix Internal Error when CONTINUE HANDLER handles exception raised before Conditional Statement (IF, WHILE, ...) [spark]
miland-db opened a new pull request, #53894:
URL: https://github.com/apache/spark/pull/53894
### What changes were proposed in this pull request?
Fix bug.
### Why are the changes needed?
Fix bug.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
New unit tests in `SqlScriptingExecutionSuite`.
### Was this patch authored or co-authored using generative AI tooling?
No.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55119][SQL] Fix Continue Handler: prevent INTERNAL_ERROR and incorrect conditional statements interruption [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #53894:
URL: https://github.com/apache/spark/pull/53894#issuecomment-3811087361
The CI job is flaky, and will be fixed by https://github.com/apache/spark/pull/54033
thanks, merging to master/4.1!
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55119][SQL] Fix Continue Handler: prevent INTERNAL_ERROR and incorrect conditional statements interruption [spark]
Posted by "miland-db (via GitHub)" <gi...@apache.org>.
miland-db commented on PR #53894:
URL: https://github.com/apache/spark/pull/53894#issuecomment-3806295305
Adding @cloud-fan, @srielau
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55119][SQL] Fix Continue Handler: prevent INTERNAL_ERROR and incorrect conditional statements interruption [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #53894:
URL: https://github.com/apache/spark/pull/53894#issuecomment-3808502023
SqlScriptingExecutionSuite fails
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55119][SQL] Fix Continue Handler: prevent INTERNAL_ERROR and incorrect conditional statements interruption [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #53894: [SPARK-55119][SQL] Fix Continue Handler: prevent INTERNAL_ERROR and incorrect conditional statements interruption
URL: https://github.com/apache/spark/pull/53894
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55119][SQL] CONTINUE handler should not interrupt conditional if exception thrown by previous statement [spark]
Posted by "miland-db (via GitHub)" <gi...@apache.org>.
miland-db commented on code in PR #53894:
URL: https://github.com/apache/spark/pull/53894#discussion_r2732650997
##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala:
##########
@@ -532,7 +532,10 @@ class WhileStatementExec(
private lazy val treeIterator: Iterator[CompoundStatementExec] =
new Iterator[CompoundStatementExec] {
- override def hasNext: Boolean = !interrupted && curr.nonEmpty
+ override def hasNext: Boolean = !interrupted && curr.nonEmpty && (state match {
+ case WhileState.Body => body.getTreeIterator.hasNext
+ case WhileState.Condition => curr.nonEmpty
+ })
Review Comment:
Added new tests and refactored the whole PR. Please take another look. Thanks!
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SQL][SCRIPTING] Fix Internal Error when CONTINUE HANDLER handles exception raised before Conditional Statement (IF, WHILE, ...) [spark]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #53894:
URL: https://github.com/apache/spark/pull/53894#issuecomment-3781032981
## ⚠️ Pull Request Title Validation
This pull request title does not contain a JIRA issue ID.
Please update the title to either:
- Include a JIRA ID: `[SPARK-12345] Your description`
- Mark as minor change: `[MINOR] Your description`
For minor changes that don't require a JIRA ticket (e.g., typo fixes), please prefix the title with `[MINOR]`.
---
*This comment was automatically generated by GitHub Actions*
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55119][SQL] CONTINUE handler should not interrupt conditional if exception thrown by previous statement [spark]
Posted by "miland-db (via GitHub)" <gi...@apache.org>.
miland-db commented on PR #53894:
URL: https://github.com/apache/spark/pull/53894#issuecomment-3782159605
@davidm-db Please take a look
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55119][SQL] CONTINUE handler should not interrupt conditional if exception thrown by previous statement [spark]
Posted by "davidm-db (via GitHub)" <gi...@apache.org>.
davidm-db commented on code in PR #53894:
URL: https://github.com/apache/spark/pull/53894#discussion_r2716305968
##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala:
##########
@@ -532,7 +532,10 @@ class WhileStatementExec(
private lazy val treeIterator: Iterator[CompoundStatementExec] =
new Iterator[CompoundStatementExec] {
- override def hasNext: Boolean = !interrupted && curr.nonEmpty
+ override def hasNext: Boolean = !interrupted && curr.nonEmpty && (state match {
+ case WhileState.Body => body.getTreeIterator.hasNext
+ case WhileState.Condition => curr.nonEmpty
+ })
Review Comment:
This change is going to have a bug, the example is:
```
BEGIN
DECLARE i INT DEFAULT 0;
DECLARE s INT DEFAULT 0;
DECLARE ch_sum INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR DIVIDE_BY_ZERO SET ch_sum = ch_sum + 1;
WHILE i < 5 DO
SET i = i + 1;
IF (1/0)==0 THEN
SELECT 100;
END IF;
END WHILE;
SELECT i, s as sum, ch_sum;
END
```
This loop will have only one iteration, because the IF is the last nested statement in the WHILE's body, the `hasNext` check like this will fail because `body.getTreeIterator.hasNext` will return `false`, which will prevent us from moving to the condition of the WHILE, and thus to the next iteration.
It looks like this is not needed at all, but let's test without it and see is anything is failing and then figure out a better way to do it.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org