rekbun commented on PR #59522: URL: https://github.com/apache/spark/pull/59522#issuecomment-6859823579
I pushed the rework (92ad2d4). It's stacked on #60256's new head and on #60453, a separate fix it needs (the memory bullet below). - `PackScanPartitionsExec` goes between a `ShuffleExchangeExec` and its child, as described above, and decides its groups from the scan's partitions when it executes. `BatchScanExec`, `CacheManager` and `ReplaceHashWithSortAgg` are back to master. - The node reports `UnknownPartitioning(0)`. Above the shuffle, one reader does look at the layout from before it: an AQE local read with one mapper per task. Over a packed shuffle that read reports none, and where an operator needs the scan's layout, AQE keeps the full shuffle read. That's why `KeyGroupedPartitioningPackScanPartitionsSuite` excludes "SPARK-59671: an AQE local read over a split scan does not lose matches": its setup expects the scan's keyed layout to reach the local read. `PackV2ScanPartitionsSuite` runs the same query with packing and keeps its answer checks. - With the opt-in local pipelined shuffle, a plan with a packing node keeps regular shuffles, since the node's width is known only at execution. `PackV2ScanPartitionsPipelinedSuite` pins that. - The operator list is a conservative start from `DisableUnnecessaryBucketedScan`'s. Expand and generate also map partitions one to one; I left them out for now. - Memory: a packed task runs the operators below the node once per input, and keeps whatever they leave to task completion until it ends. A partial hash aggregate's codegen fast hash map left its bucket array, 512 KiB per input, so 2,048 inputs in one task held 1 GiB. Master has the same problem in fewer plans: `GroupPartitionsExec` above a distinct aggregation's first partial aggregate held 84 MiB with 168 splits of one key. The fix is #60453 (SPARK-61647): `close()` drops the buckets. With it, a packed task over a hash aggregate keeps about 2 KiB per input. - The read suite again checks that packed tasks prefer their inputs' majority host. I had dropped that check here earlier, but finding 1 on #60256 was about exactly this node over a scan's mapped RDD, so this is the end-to-end check for it. Two corrections to my last comment: - Emptied inputs stay in the groups so that every scan partition is still computed once, as on master, not because of global aggregates: the final aggregate emits its row either way. - The rule runs after `RemoveRedundantSorts` for the local sort under a shuffle, and before columnar transitions and codegen. The skew-join reason was wrong: a shuffle that skew join optimization adds sits above a split join, which the rule doesn't follow. -- 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]
