cloud-fan commented on code in PR #50024:
URL: https://github.com/apache/spark/pull/50024#discussion_r1964795587


##########
sql/core/src/main/scala/org/apache/spark/sql/classic/SparkSession.scala:
##########
@@ -453,18 +453,23 @@ class SparkSession private(
       // collect results immediately to maintain execution order.
       // This ensures we respect the contract of SqlScriptingExecution API.
       var df: Option[DataFrame] = sse.getNextResult
+      var resultSchema: Option[StructType] = None
       while (df.isDefined) {
         sse.withErrorHandling {
           // Collect results from the current DataFrame.
           result = Some(df.get.collect().toSeq)
+          resultSchema = Some(df.get.schema)
         }
         df = sse.getNextResult
       }
 
       if (result.isEmpty) {
         emptyDataFrame
       } else {
-        val attributes = DataTypeUtils.toAttributes(result.get.head.schema)

Review Comment:
   when is this different from `resultSchema.get`?



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