yashdotrv commented on PR #27129: URL: https://github.com/apache/datafusion/pull/27129#issuecomment-7067788651
> [@yashdotrv](https://github.com/yashdotrv) thanks for the quick turnaround; every point from the first round is addressed. One new problem remains: the charge counts the whole buffer behind a zero-copy slice, so a grouped query without a hash repartition goes from passing to `ResourcesExhausted`. Details and a fix are inline on `incoming_state_batch_reservation_bytes`. The fix changes how the new tests should build their large state batch, so I've also asked for one more test there. @jayzhan211 Thanks for catching the zero-copy buffer slicing issue and for the detailed suggestions! I have updated the PR and rebased against the latest `main`: 1. **Zero-Copy Slice Buffer Accounting:** - In `incoming_state_batch_reservation_bytes`, added a fast check `buffer_bytes <= in_flight_bytes`. - When `buffer_bytes > in_flight_bytes`, we now measure the memory actually referenced by the slice's rows using `SpilledRowSizes::new(batch)`. Slices of larger batches (e.g., when `repartition_aggregations = false`) will not double-charge the shared parent buffer that the producer already tracks. 2. **Realistic Test Payloads:** - Updated existing unit tests to use payloads that genuinely exceed the per-row threshold (e.g. `ListArray` with 131k elements for `array_agg`, and large `Utf8` strings). 3. **New Test Coverage:** - `final_hash_does_not_charge_buffers_shared_by_slices`: verifies that 8,192-row slices from a 1M-group batch (16 MB buffer) are not over-charged and run cleanly. - `final_aggregate_does_not_charge_bounded_state_batch`: pins the per-row rule by asserting an 8,192-row batch of two `Int64` states (128 KB) in a 96 KB pool is not charged. - `single_aggregate_does_not_charge_raw_input`: verifies that ungrouped `Single` mode over raw input (64 rows of 16 KB strings = 1 MB in a 512 KB pool) does not charge raw input batches. -- 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]
