rluvaton commented on code in PR #17163: URL: https://github.com/apache/datafusion/pull/17163#discussion_r2288432077
########## datafusion/physical-plan/src/sorts/sort.rs: ########## @@ -299,13 +307,63 @@ impl ExternalSorter { batch_size, sort_spill_reservation_bytes, sort_in_place_threshold_bytes, + cursor_batch_ratio, }) } + /// Calculates the ratio of memory used by the sort cursor to the original `RecordBatch`. + /// Returns the ratio `(cursor_size / batch_size) + 1.0`, representing the expected memory multiplier + /// when allocating space for both the original batch and its associated cursor. + /// + /// Mirrors the cursor selection logic in `StreamingMerge::build` + /// Performs the same conversion for ratio estimation, but discards the result. Review Comment: I don't think this logic should be here, but instead in the location that allocate that data, as otherwise no-one would know they should change it -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org