davidm-db commented on code in PR #47403:
URL: https://github.com/apache/spark/pull/47403#discussion_r1688249618


##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingInterpreter.scala:
##########
@@ -73,11 +74,19 @@ case class SqlScriptingInterpreter() {
           .map(new SingleStatementExec(_, Origin(), isInternal = true))
           .reverse
         new CompoundBodyExec(
-          body.collection.map(st => transformTreeIntoExecutable(st)) ++ 
dropVariables)
+          body.collection.map(st => transformTreeIntoExecutable(st)) ++ 
dropVariables, session)
       case sparkStatement: SingleStatement =>
         new SingleStatementExec(
           sparkStatement.parsedPlan,
           sparkStatement.origin,
-          isInternal = false)
+          shouldCollectResult = true)
     }
+
+  def execute(compoundBody: CompoundBody): Iterator[Array[Row]] = {

Review Comment:
   We did it the way you suggested before, but as soon as we started 
introducing exception handling, we figured out it's hardly extensible in the 
future. When SQL statements throws an exception, exception handlers need to be 
executed immediately, and we need interpreter for that - hence, we need to do 
execution within the interpreter as well.



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