jerrypeng commented on code in PR #59523:
URL: https://github.com/apache/spark/pull/59523#discussion_r4547310709
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/EnablePipelinedShuffle.scala:
##########
@@ -127,24 +132,19 @@ object EnablePipelinedShuffle extends Rule[SparkPlan] {
* True if any [[ShuffleExchangeExec]] in `plan` is read by an operator the
channel transport
* cannot serve. The unsupported operators (see class doc for why each is
fatal) are
* `CoalesceExec`, `CartesianProductExec`, and the limit operators
`CollectLimitExec` /
- * `CollectTailExec` / `TakeOrderedAndProjectExec`. For each such operator
anywhere in the plan,
- * check whether a shuffle is reachable below it.
- *
- * The reachability walk descends through EVERY child of a non-exchange node
-- not only unary
- * children -- so a shuffle behind a `UnionExec`/join (a `BinaryExecNode`)
beneath the operator
- * is still found. It stops at the FIRST [[ShuffleExchangeExec]] on each
path: a shuffle deeper
- * than that first one is not read by this operator (the intervening
exchange's own reader reads
- * one reduce partition per task), so it is not this operator's concern.
+ * `CollectTailExec` / `TakeOrderedAndProjectExec`, plus cached
`AttachDistributedSequenceExec`.
+ * A shuffle above an unsupported operator with shuffle-free input does not
disqualify the plan.
Review Comment:
Agreed. I reproduced your exact query with AQE both enabled and disabled.
The hidden regular shuffle causes the mixed-shuffle rejection, and the failure
predates this PR.
I’ll take the separate-JIRA option you suggested. For this PR, I’ll remove
the overbroad sentence and the limit-operator assertions from the new test, and
clarify that the ancestry check only detects visible exchanges—it does not
establish execution safety for operators that construct hidden shuffles.
The top-K fallback should be addressed separately with end-to-end coverage
for both AQE modes. That also gives us room to evaluate the optimization
tradeoff for one-partition inputs, where top-K does not need a hidden shuffle.
--
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]