This is an automated email from the ASF dual-hosted git repository.

ruifengz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 7a347c60dae [MINOR][CONNECT] Remove unnecessary creation of `planner` 
in `handleWriteOperation` and `handleWriteOperationV2`
7a347c60dae is described below

commit 7a347c60dae0412087856756714feb6c80a2acb1
Author: Ruifeng Zheng <ruife...@apache.org>
AuthorDate: Tue Apr 25 11:26:05 2023 +0800

    [MINOR][CONNECT] Remove unnecessary creation of `planner` in 
`handleWriteOperation` and `handleWriteOperationV2`
    
    ### What changes were proposed in this pull request?
    Remove unnecessary creation of `planner` in `handleWriteOperation` and 
`handleWriteOperationV2`
    
    ### Why are the changes needed?
    `handleWriteOperation` and `handleWriteOperationV2` themselves are the 
methods of planner, no need to create another planner to call 
`transformRelation`
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    existing UTs
    
    Closes #40936 from zhengruifeng/connect_write_remove_planner.
    
    Authored-by: Ruifeng Zheng <ruife...@apache.org>
    Signed-off-by: Ruifeng Zheng <ruife...@apache.org>
---
 .../org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala
 
b/connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala
index 59c407c8eea..9c37aba32d3 100644
--- 
a/connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala
+++ 
b/connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala
@@ -1920,8 +1920,7 @@ class SparkConnectPlanner(val session: SparkSession) {
    */
   private def handleWriteOperation(writeOperation: proto.WriteOperation): Unit 
= {
     // Transform the input plan into the logical plan.
-    val planner = new SparkConnectPlanner(session)
-    val plan = planner.transformRelation(writeOperation.getInput)
+    val plan = transformRelation(writeOperation.getInput)
     // And create a Dataset from the plan.
     val dataset = Dataset.ofRows(session, logicalPlan = plan)
 
@@ -1991,8 +1990,7 @@ class SparkConnectPlanner(val session: SparkSession) {
    */
   def handleWriteOperationV2(writeOperation: proto.WriteOperationV2): Unit = {
     // Transform the input plan into the logical plan.
-    val planner = new SparkConnectPlanner(session)
-    val plan = planner.transformRelation(writeOperation.getInput)
+    val plan = transformRelation(writeOperation.getInput)
     // And create a Dataset from the plan.
     val dataset = Dataset.ofRows(session, logicalPlan = plan)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to