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

gurwls223 pushed a commit to branch branch-3.5
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.5 by this push:
     new f497ab568bb [SPARK-43755][CONNECT][MINOR] Open 
`AdaptiveSparkPlanHelper.allChildren` instead of using copy in `MetricGenerator`
f497ab568bb is described below

commit f497ab568bb9541621785492e699168dd8cb996c
Author: Juliusz Sompolski <[email protected]>
AuthorDate: Wed Jul 19 09:51:41 2023 +0900

    [SPARK-43755][CONNECT][MINOR] Open `AdaptiveSparkPlanHelper.allChildren` 
instead of using copy in `MetricGenerator`
    
    ### What changes were proposed in this pull request?
    
    Minor refactor - make `AdaptiveSparkPlanHelper.allChildren` protected in 
place of private, so that we don't have to copy it over, risking that the two 
versions will get out of sync.
    
    ### Why are the changes needed?
    
    Minor refactor.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    CI
    
    Closes #42060 from juliuszsompolski/SPARK-43755-fup.
    
    Authored-by: Juliusz Sompolski <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
    (cherry picked from commit 227e28cf84c0720ef0515a3744bc017b6eab26ed)
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 .../org/apache/spark/sql/connect/utils/MetricGenerator.scala      | 8 +-------
 .../spark/sql/execution/adaptive/AdaptiveSparkPlanHelper.scala    | 2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git 
a/connector/connect/server/src/main/scala/org/apache/spark/sql/connect/utils/MetricGenerator.scala
 
b/connector/connect/server/src/main/scala/org/apache/spark/sql/connect/utils/MetricGenerator.scala
index 88120e616ef..6395fb588ab 100644
--- 
a/connector/connect/server/src/main/scala/org/apache/spark/sql/connect/utils/MetricGenerator.scala
+++ 
b/connector/connect/server/src/main/scala/org/apache/spark/sql/connect/utils/MetricGenerator.scala
@@ -22,7 +22,7 @@ import scala.collection.JavaConverters._
 import org.apache.spark.connect.proto.ExecutePlanResponse
 import org.apache.spark.sql.DataFrame
 import org.apache.spark.sql.execution.SparkPlan
-import org.apache.spark.sql.execution.adaptive.{AdaptiveSparkPlanExec, 
AdaptiveSparkPlanHelper, QueryStageExec}
+import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
 
 /**
  * Helper object for generating responses with metrics from queries.
@@ -47,12 +47,6 @@ private[connect] object MetricGenerator extends 
AdaptiveSparkPlanHelper {
     allChildren(p).flatMap(c => transformPlan(c, p.id))
   }
 
-  private def allChildren(p: SparkPlan): Seq[SparkPlan] = p match {
-    case a: AdaptiveSparkPlanExec => Seq(a.executedPlan)
-    case s: QueryStageExec => Seq(s.plan)
-    case _ => p.children
-  }
-
   private def transformPlan(
       p: SparkPlan,
       parentId: Int): Seq[ExecutePlanResponse.Metrics.MetricObject] = {
diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AdaptiveSparkPlanHelper.scala
 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AdaptiveSparkPlanHelper.scala
index eecfa40e8d0..c58d925f28e 100644
--- 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AdaptiveSparkPlanHelper.scala
+++ 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AdaptiveSparkPlanHelper.scala
@@ -122,7 +122,7 @@ trait AdaptiveSparkPlanHelper {
     subqueries ++ subqueries.flatMap(subqueriesAll)
   }
 
-  private def allChildren(p: SparkPlan): Seq[SparkPlan] = p match {
+  protected def allChildren(p: SparkPlan): Seq[SparkPlan] = p match {
     case a: AdaptiveSparkPlanExec => Seq(a.executedPlan)
     case s: QueryStageExec => Seq(s.plan)
     case _ => p.children


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to