miland-db commented on code in PR #52371:
URL: https://github.com/apache/spark/pull/52371#discussion_r2388408330


##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecution.scala:
##########
@@ -78,14 +78,34 @@ class SqlScriptingExecution(
    */
   private def injectLeaveStatement(executionPlan: NonLeafStatementExec, label: 
String): Unit = {
     // Go as deep as possible, to find a leaf node. Instead of a statement that
-    //   should be executed next, inject LEAVE statement in its place.
+    // should be executed next, inject LEAVE statement in its place.
     var currExecPlan = executionPlan
     while (currExecPlan.curr.exists(_.isInstanceOf[NonLeafStatementExec])) {
       currExecPlan = currExecPlan.curr.get.asInstanceOf[NonLeafStatementExec]
     }
     currExecPlan.curr = Some(new LeaveStatementExec(label))
   }
 
+  /**
+   * Helper method to execute interrupts to ConditionalStatements.
+   * @param executionPlan Execution plan.
+   */
+  private def interruptConditionalStatements(executionPlan: 
NonLeafStatementExec): Unit = {
+    // Go as deep as possible into the execution plan children nodes, to find 
a leaf node.
+    // That leaf node is the next statement that is to be executed. If the 
parent node of that
+    // leaf node is a conditional statement, skip the conditional statement 
entirely.

Review Comment:
   This should happen only in case when the statement that throws is the 
`condition` in that conditional statement. Maybe we should mention that.
   
   Also, is there a way to use `SqlScriptingExecutionNodeSuite` to test this 
method on conditional statements? It would be great if we had those tests.



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

Reply via email to