This is an automated email from the ASF dual-hosted git repository.
beliefer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new dc91fd8b95 [GLUTEN-11161][CORE] Refactor findAllLeafTransformers for
WholeStageTransformer (#11162)
dc91fd8b95 is described below
commit dc91fd8b9599689a715410f4eabd87a1ecab71ba
Author: Jiaan Geng <[email protected]>
AuthorDate: Tue Nov 25 17:23:48 2025 +0800
[GLUTEN-11161][CORE] Refactor findAllLeafTransformers for
WholeStageTransformer (#11162)
---
.../gluten/execution/WholeStageTransformer.scala | 33 ++++++++--------------
1 file changed, 11 insertions(+), 22 deletions(-)
diff --git
a/gluten-substrait/src/main/scala/org/apache/gluten/execution/WholeStageTransformer.scala
b/gluten-substrait/src/main/scala/org/apache/gluten/execution/WholeStageTransformer.scala
index 859b07af69..8c85add1fc 100644
---
a/gluten-substrait/src/main/scala/org/apache/gluten/execution/WholeStageTransformer.scala
+++
b/gluten-substrait/src/main/scala/org/apache/gluten/execution/WholeStageTransformer.scala
@@ -271,30 +271,19 @@ case class WholeStageTransformer(child: SparkPlan,
materializeInput: Boolean = f
/** Find all [[LeafTransformSupport]] in one WholeStageTransformer */
private def findAllLeafTransformers(): Seq[LeafTransformSupport] = {
- val allLeafTransformers = new mutable.ListBuffer[LeafTransformSupport]()
-
- def transformChildren(plan: SparkPlan): Unit = {
- if (plan != null && plan.isInstanceOf[TransformSupport]) {
- plan match {
- case transformer: LeafTransformSupport =>
- allLeafTransformers.append(transformer)
- case _ =>
- }
-
- // according to the substrait plan order
- // SHJ may include two leaves in a whole stage.
- plan match {
- case shj: HashJoinLikeExecTransformer =>
- transformChildren(shj.streamedPlan)
- transformChildren(shj.buildPlan)
- case t: TransformSupport =>
- t.children.foreach(transformChildren(_))
- }
- }
+
+ def collectLeafTransformers(plan: SparkPlan): Seq[LeafTransformSupport] =
plan match {
+ case transformer: LeafTransformSupport =>
+ Seq(transformer)
+ case shj: HashJoinLikeExecTransformer =>
+ collectLeafTransformers(shj.streamedPlan) ++
collectLeafTransformers(shj.buildPlan)
+ case t: TransformSupport =>
+ t.children.flatMap(collectLeafTransformers)
+ case _ =>
+ Seq.empty
}
- transformChildren(child)
- allLeafTransformers.toSeq
+ collectLeafTransformers(child)
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]