zhztheplayer commented on code in PR #11069:
URL: 
https://github.com/apache/incubator-gluten/pull/11069#discussion_r2515035459


##########
backends-velox/src/main/scala/org/apache/gluten/extension/AppendBatchResizeForShuffleInputAndOutput.scala:
##########
@@ -44,24 +45,36 @@ case class AppendBatchResizeForShuffleInputAndOutput() 
extends Rule[SparkPlan] {
           VeloxResizeBatchesExec(shuffle.child, range.min, range.max)
         shuffle.withNewChildren(Seq(appendBatches))
       case a @ AQEShuffleReadExec(
-            ShuffleQueryStageExec(_, shuffle: ColumnarShuffleExchangeExec, _),
+            ShuffleQueryStageExec(
+              _,
+              shuffle: ColumnarShuffleExchangeExec |
+              ReusedExchangeExec(_, _: ColumnarShuffleExchangeExec),
+              _),
             _)
           if resizeBatchesShuffleOutputEnabled &&
             shuffle.shuffleWriterType.requiresResizingShuffleOutput =>
         VeloxResizeBatchesExec(a, range.min, range.max)
-      // Since it's transformed in a bottom to up order, so we may first 
encountered
+      // Since it's transformed in a bottom to up order, so we may first 
encounter
       // ShuffeQueryStageExec, which is transformed to 
VeloxResizeBatchesExec(ShuffeQueryStageExec),
       // then we see AQEShuffleReadExec
       case a @ AQEShuffleReadExec(
             VeloxResizeBatchesExec(
-              s @ ShuffleQueryStageExec(_, shuffle: 
ColumnarShuffleExchangeExec, _),
+              s @ ShuffleQueryStageExec(
+                _,
+                shuffle: ColumnarShuffleExchangeExec |
+                ReusedExchangeExec(_, _: ColumnarShuffleExchangeExec),

Review Comment:
   It doesn't likely compile.
   
   Let's use this shortcut instead: 
https://github.com/apache/spark/blob/9ff0fba06e758d2509dd8eb7a38b01cc8720d43d/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/QueryStageExec.scala#L203-L208
 
   



##########
backends-velox/src/main/scala/org/apache/gluten/extension/AppendBatchResizeForShuffleInputAndOutput.scala:
##########
@@ -44,24 +45,36 @@ case class AppendBatchResizeForShuffleInputAndOutput() 
extends Rule[SparkPlan] {
           VeloxResizeBatchesExec(shuffle.child, range.min, range.max)
         shuffle.withNewChildren(Seq(appendBatches))
       case a @ AQEShuffleReadExec(
-            ShuffleQueryStageExec(_, shuffle: ColumnarShuffleExchangeExec, _),
+            ShuffleQueryStageExec(
+              _,
+              shuffle: ColumnarShuffleExchangeExec |
+              ReusedExchangeExec(_, _: ColumnarShuffleExchangeExec),
+              _),
             _)
           if resizeBatchesShuffleOutputEnabled &&
             shuffle.shuffleWriterType.requiresResizingShuffleOutput =>
         VeloxResizeBatchesExec(a, range.min, range.max)
-      // Since it's transformed in a bottom to up order, so we may first 
encountered
+      // Since it's transformed in a bottom to up order, so we may first 
encounter
       // ShuffeQueryStageExec, which is transformed to 
VeloxResizeBatchesExec(ShuffeQueryStageExec),
       // then we see AQEShuffleReadExec
       case a @ AQEShuffleReadExec(
             VeloxResizeBatchesExec(
-              s @ ShuffleQueryStageExec(_, shuffle: 
ColumnarShuffleExchangeExec, _),
+              s @ ShuffleQueryStageExec(
+                _,
+                shuffle: ColumnarShuffleExchangeExec |
+                ReusedExchangeExec(_, _: ColumnarShuffleExchangeExec),

Review Comment:
   I found this comment:
   
   ```
   // Since it's transformed in a bottom to up order, so we may first encounter
   // ShuffeQueryStageExec, which is transformed to 
VeloxResizeBatchesExec(ShuffeQueryStageExec),
   // then we see AQEShuffleReadExec
   ```
   
   Maybe `transformDown` is more feasible in this case. cc @WangGuangxin 



-- 
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]

Reply via email to