ulysses-you commented on PR #60658:
URL: https://github.com/apache/spark/pull/60658#issuecomment-6999788610

   Thanks for the review, @dongjoon-hyun. Pushed the changes as `1730ea6` (on 
top of `6246042`); summary of what changed:
   
   - **Failable layouts**: the walk tracks whether a crossed operator removes 
rows (filter, non-outer generate, final window group limit and broadcast join) 
and retargets only when every layout expression passes 
`ExprUtils.canEvaluateUnconditionally`. Test: `having` over `cast(code)` keeps 
both shuffles and succeeds; an identity layout still crosses a filter.
   - **Per-candidate rewrites**: one pass rewrites every candidate and 
validates the plan once; when that check refuses a rewrite, the candidates are 
retried one by one. Tests cover two independent branches (2 shuffles) and one 
refused branch that no longer reverts the other (3 instead of 4).
   - **Final layout check**: accepts any keyed member of the reported 
collection, not only the first; the `item_id, item_id AS k` query now rewrites 
(1 shuffle).
   - **Subset layouts**: the rule follows `ClusteredDistribution`, so the 
decision is `spark.sql.requireAllClusterKeysForDistribution`, the same policy 
hash partitioning and a keyed layout already answer to. No new config; with the 
flag set, the subset keeps both shuffles and a layout covering every key still 
rewrites.
   - **Non-adaptive list**: the rule also runs in `QueryExecution.preparations` 
after `EnsureRequirements`, before the first stamp, with the same subquery 
gate. Tests cover the rewrite and the gate in both lists.
   - **Nits**: `AliasHelper.getRenameMap` is shared with `PushDownLocalSort`; 
`rebind` takes the output expressions and the child's output set, the aggregate 
lambda no longer shadows `layout`, and the unreachable case is gone. The class 
doc's placement paragraph was dropped; the config docs now describe physical 
preparation and scope the statistics trade-off to adaptive plans.
   
   Tests: `PushDownKeyedShuffleExchangeSuite` (44), 
`PushDownShuffleExchangeThroughUnionSuite`, `KeyGroupedPartitioningSuite`, 
`PushDownLocalSortSuite` (422 total), `AdaptiveQueryExecSuite` (158), 
scalastyle on `catalyst` and `sql` clean.
   


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