amaliujia commented on code in PR #40782:
URL: https://github.com/apache/spark/pull/40782#discussion_r1166244987


##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -439,8 +439,19 @@ class SparkSession private[sql] (
   }
 
   private[sql] def execute[T](plan: proto.Plan, encoder: AgnosticEncoder[T]): 
SparkResult[T] = {
-    val value = client.execute(plan)
-    val result = new SparkResult(value, allocator, encoder)
+    val result = if (plan.hasRoot && plan.getRoot.hasLocalRelation) {
+      // Short circuit local relation RPCs
+      val localRelation = plan.getRoot.getLocalRelation
+      new SparkResult(
+        Seq.empty[proto.ExecutePlanResponse].iterator.asJava,

Review Comment:
   I am wondering if you can populate the data from the LocalRelation into an 
instance of `proto.ExecutePlanResponse` thus we do not need to branch the code 
in `SparkResult`?



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