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


##########
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:
   Since the logic here is wrapping a new node `VeloxResizeBatches` when 
matched, if we use transformDown here,  the logic here will be much more 
complicated . 
   
   For example,  if it's transform down and when we match node `a`, it 
transform it to `VeloxResizeBatches(a)`, then go down the tree node, it will 
encounter node `a` again, so we have to do something to avoid  wrap 
`VeloxResizeBatches` again and again



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