wForget commented on code in PR #45373:
URL: https://github.com/apache/spark/pull/45373#discussion_r1513786488


##########
sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -4483,6 +4478,17 @@ class Dataset[T] private[sql](
     }
   }
 
+  /** Returns a optimized plan for CommandResult, convert to `LocalRelation`. 
*/
+  private def withCommandResultOptimized: Dataset[T] = {
+    logicalPlan match {
+      case c: CommandResult =>
+        // Convert to `LocalRelation` and let `ConvertToLocalRelation` do the 
casting locally to
+        // avoid triggering a job
+        Dataset(sparkSession, LocalRelation(c.output, c.rows))

Review Comment:
   > Maybe we should reconsider this: [#40779 
(comment)](https://github.com/apache/spark/pull/40779#issuecomment-1506949427)
   
   I submitted a new pr #45397 for this, could you please take a quick look?



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