parthchandra opened a new issue, #7852:
URL: https://github.com/apache/datafusion-comet/issues/7852

   `SortInputCoalesceExec` (#7696) combines small input batches in front of a 
native sort, behind `spark.comet.exec.sort.coalesceInput.enabled` (off by 
default). It works around DataFusion 55.2's `ExternalSorter` merging one stream 
per buffered batch on its spill path, and for multi-key sorts in memory (#5686).
   
   apache/datafusion#26931 forms runs from small batches inside the sorter and 
falls back to the original batches when a run cannot be admitted. Once Comet's 
DataFusion includes it, decide whether to remove the operator or enable it by 
default.
   
   **What decides it**
   
   Run each of these with the flag off and on, against the new sorter:
   
   1. `cargo bench -p datafusion-comet-operators --bench sort_small_batches`, 
on an x86_64 server with AVX2 (the target Comet builds for). Include the 512- 
and 1024-row cases with combining forced on. Today the operator passes 512 rows 
and up through unchanged, and #5686 measured 1.49x from combining 1024-row 
batches.
   2. The spilling Spark stage timings from #7696: 4000 x 100 (blocks of ~200 
rows) at 512m off-heap, and 8000 x 100 (blocks of ~50 rows) at 256m.
   3. The in-memory stage past the gate (40 M wide rows, 2000 x 400, 1g 
off-heap), which was about 16% slower with the flag on. Profile it with the 
flag off and on. Without the coalescer, DataFusion 55.2 already concatenates a 
single-key sort's batches into runs of about the same size, so the copy alone 
may not explain the cost.
   
   - **Remove the operator** if the new sorter with the flag off matches or 
beats the flag on in runs 1 and 2.
   - **Enable it by default** if the flag still wins in runs 1 and 2, the 
in-memory cost in run 3 is gone or explained and avoidable, and 
`a_combined_batch_can_exceed_a_share_the_raw_batches_fit` in `fair_pool.rs` no 
longer fails. That test pins the memory limitation that keeps the flag off.
   


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