marin-ma commented on code in PR #11252: URL: https://github.com/apache/incubator-gluten/pull/11252#discussion_r2665450523
########## gluten-substrait/src/main/scala/org/apache/spark/sql/execution/RegenerateTransformStageId.scala: ########## @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.spark.sql.execution + +import org.apache.gluten.exception.GlutenException +import org.apache.gluten.execution.WholeStageTransformer +import org.apache.gluten.sql.shims.SparkShimLoader + +import org.apache.spark.sql.catalyst.rules.Rule +import org.apache.spark.sql.execution.adaptive.{AdaptiveSparkPlanExec, AdaptiveSparkPlanHelper, BroadcastQueryStageExec, ShuffleQueryStageExec} +import org.apache.spark.sql.execution.exchange.{BroadcastExchangeLike, ReusedExchangeExec, ShuffleExchangeLike} +import org.apache.spark.sql.internal.SQLConf + +import java.util.concurrent.atomic.AtomicInteger + +import scala.collection.mutable + +/** + * Regenerate `transformStageId` for `WholeStageTransformerExec` when AQE is on. QueryStages are + * invisible to each other during execution. During runtime, the transformStageId of each QueryStage + * starts from 1. This rule updates the whole plan tree with incremental and unique transform stage + * id before the final execution. + */ +case class RegenerateTransformStageId() extends Rule[SparkPlan] with AdaptiveSparkPlanHelper { Review Comment: > Do you think it's feasible to change ColumnarCollapseTransformStages to leave all stage IDs unassigned (e.g., -1), then rely on RegenerateTransformStageId to assign all IDs, both for AQE and non-AQE cases? So it's clear that only RegenerateTransformStageId manages these IDs. Yes make sense. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
