vranes opened a new pull request, #57275:
URL: https://github.com/apache/spark/pull/57275

   ### What changes were proposed in this pull request?
   
   `BinByExec` now mixes in `PartitioningPreservingUnaryExecNode` and defines 
`outputExpressions = output`, so it reports a meaningful `outputPartitioning` 
instead of the `UnknownPartitioning(0)` default.
   
   `BinByExec.output` contains no `Alias` (renamed output columns bake the name 
directly into the `AttributeReference`), so the trait's no-alias path applies: 
a child partitioning is kept only when its keys reference the operator's 
output. A partitioning on a pass-through or range column survives; one on a 
scaled `DISTRIBUTE` column names a fresh `ExprId` absent from the output and is 
dropped to `UnknownPartitioning`.
   
   This is safe because `BIN BY` is a per-partition transform (no row crosses a 
partition) and pass-through columns hold identical values across an input row's 
sub-rows, so a child partitioning on them still holds.
   
   ### Why are the changes needed?
   
   Without an `outputPartitioning`, a downstream operator clustered on a 
pass-through column that the child already partitions on gets an unnecessary 
shuffle.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. `BIN BY` is gated off by default 
(`spark.sql.binByRelationOperator.enabled`).
   
   ### How was this patch tested?
   
   `ProjectedOrderingAndPartitioningSuite`: three tests covering a pass-through 
key preserved as `HashPartitioning`, a scaled `DISTRIBUTE` key dropped to 
`UnknownPartitioning`, and a mixed pass-through + `DISTRIBUTE` key dropped 
whole.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Anthropic)
   


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