Skip to content

Commit f497ab5

Browse files
juliuszsompolskiHyukjinKwon
authored andcommitted
[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 227e28c) Signed-off-by: Hyukjin Kwon <[email protected]>
1 parent b831d82 commit f497ab5

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

connector/connect/server/src/main/scala/org/apache/spark/sql/connect/utils/MetricGenerator.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import scala.collection.JavaConverters._
2222
import org.apache.spark.connect.proto.ExecutePlanResponse
2323
import org.apache.spark.sql.DataFrame
2424
import org.apache.spark.sql.execution.SparkPlan
25-
import org.apache.spark.sql.execution.adaptive.{AdaptiveSparkPlanExec, AdaptiveSparkPlanHelper, QueryStageExec}
25+
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
2626

2727
/**
2828
* Helper object for generating responses with metrics from queries.
@@ -47,12 +47,6 @@ private[connect] object MetricGenerator extends AdaptiveSparkPlanHelper {
4747
allChildren(p).flatMap(c => transformPlan(c, p.id))
4848
}
4949

50-
private def allChildren(p: SparkPlan): Seq[SparkPlan] = p match {
51-
case a: AdaptiveSparkPlanExec => Seq(a.executedPlan)
52-
case s: QueryStageExec => Seq(s.plan)
53-
case _ => p.children
54-
}
55-
5650
private def transformPlan(
5751
p: SparkPlan,
5852
parentId: Int): Seq[ExecutePlanResponse.Metrics.MetricObject] = {

sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AdaptiveSparkPlanHelper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ trait AdaptiveSparkPlanHelper {
122122
subqueries ++ subqueries.flatMap(subqueriesAll)
123123
}
124124

125-
private def allChildren(p: SparkPlan): Seq[SparkPlan] = p match {
125+
protected def allChildren(p: SparkPlan): Seq[SparkPlan] = p match {
126126
case a: AdaptiveSparkPlanExec => Seq(a.executedPlan)
127127
case s: QueryStageExec => Seq(s.plan)
128128
case _ => p.children

0 commit comments

Comments
 (0)