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: [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]