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


##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala:
##########
@@ -119,20 +148,112 @@ class SingleStatementExec(
     origin.sqlText.get.substring(origin.startIndex.get, origin.stopIndex.get + 
1)
   }
 
-  override def reset(): Unit = isExecuted = false
+  override def reset(): Unit = {
+    raisedError = false
+    errorState = None
+    error = None
+    rethrow = None
+    result = None // Should we do this?
+  }
+
+  def execute(session: SparkSession): Unit = {
+    try {
+      val rows = Some(Dataset.ofRows(session, parsedPlan).collect())
+      if (shouldCollectResult) {
+        result = rows
+      }
+    } catch {
+      case e: SparkThrowable =>
+        raisedError = true
+        errorState = Some(e.getSqlState)
+        error = Some(e)
+        e match {
+          case throwable: Throwable =>

Review Comment:
   @cloud-fan Are there any cases where something that implements 
`SparkThrowable` isn't also `Throwable`?



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