You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by be...@apache.org on 2025/11/26 09:44:44 UTC

(incubator-gluten) branch main updated: [GLUTEN-11191][CORE] Refactor leafInputMetricsUpdater for WholeStageTransformer (#11192)

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 295625e0b4 [GLUTEN-11191][CORE] Refactor leafInputMetricsUpdater for WholeStageTransformer (#11192)
295625e0b4 is described below

commit 295625e0b47ba9ba902c77f97ee0f1ae55e58b79
Author: Jiaan Geng <be...@163.com>
AuthorDate: Wed Nov 26 17:44:40 2025 +0800

    [GLUTEN-11191][CORE] Refactor leafInputMetricsUpdater for WholeStageTransformer (#11192)
---
 .../gluten/execution/WholeStageTransformer.scala       | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 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 5848985be9..8ced5aa45c 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
@@ -45,7 +45,6 @@ import org.apache.hadoop.fs.viewfs.ViewFileSystemUtils
 
 import scala.collection.JavaConverters._
 import scala.collection.mutable
-import scala.collection.mutable.ArrayBuffer
 
 case class TransformContext(outputAttributes: Seq[Attribute], root: RelNode)
 
@@ -417,20 +416,11 @@ case class WholeStageTransformer(child: SparkPlan, materializeInput: Boolean = f
   }
 
   private def leafInputMetricsUpdater(): InputMetricsWrapper => Unit = {
-    def collectLeaves(plan: SparkPlan, buffer: ArrayBuffer[TransformSupport]): Unit = {
-      plan match {
-        case node: TransformSupport if node.children.forall(!_.isInstanceOf[TransformSupport]) =>
-          buffer.append(node)
-        case node: TransformSupport =>
-          node.children
-            .foreach(collectLeaves(_, buffer))
-        case _ =>
-      }
+    val leaves = child.collect {
+      case plan: TransformSupport if plan.children.forall(!_.isInstanceOf[TransformSupport]) =>
+        plan
     }
-
-    val leafBuffer = new ArrayBuffer[TransformSupport]()
-    collectLeaves(child, leafBuffer)
-    val leafMetricsUpdater = leafBuffer.map(_.metricsUpdater())
+    val leafMetricsUpdater = leaves.map(_.metricsUpdater())
 
     (inputMetrics: InputMetricsWrapper) => {
       leafMetricsUpdater.foreach(_.updateInputMetrics(inputMetrics))


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org