avantgardnerio opened a new pull request, #24031:
URL: https://github.com/apache/datafusion/pull/24031

   ## Summary
   
   Adds per-output-partition slots on `BoundedWindowAggExec` that capture each 
aggregate window function's final `Accumulator::state()` at partition-close, 
plus a getter (`finalized_partition_state`) for downstream operators to read 
once a task has drained. Intended to support prefix scans over ordered window 
aggregates.
   
   Slim re-do of #24007 addressing the review there. Public surface is a single 
new `pub fn` on BWAG plus one method on the already-public `WindowState`; no 
new pub types or re-exports.
   
   ## What changed vs. #24007
   
   | Concern from review | This PR |
   |---|---|
   | `pub use window_expr::WindowFn` leaked internal enum with `Box<dyn 
Accumulator>` / `Box<dyn PartitionEvaluator>` variants | Removed. Added 
`WindowState::aggregate_state() -> Result<Option<Vec<ScalarValue>>>` on the 
already-public type. |
   | `pub type FinalizedPartitionState` alias | Removed from public API; 
private alias exists only to satisfy clippy's `type_complexity`. |
   | ~30-line getter with `Empty`/`Single`/`Multi` state machine + out-of-range 
error + mutex-poison error | 1-line getter returning 
`Option<&[Option<Vec<ScalarValue>>]>`. |
   | `Arc<[Mutex<FinalStateSlot>]>` | 
`Arc<[OnceLock<Vec<Option<Vec<ScalarValue>>>>]>` — no Mutex, no state machine, 
first-close-wins. |
   | "At most one PARTITION BY group" doctrine enforced with an error branch | 
Enforcement dropped, doctrine kept as one line of docstring. Additional groups 
on the same output partition are silently dropped. |
   
   Diff: 429 → 168 lines.
   
   ## Test plan
   - [x] `cargo test -p datafusion-physical-plan --lib 
windows::bounded_window_agg_exec::tests::finalized_partition_state_returns_single_group_state`
   - [x] `cargo test -p datafusion-physical-plan --lib windows` (11 passed)
   - [x] `cargo clippy -p datafusion-physical-plan -p datafusion-physical-expr 
--all-targets` (clean)
   - [x] `cargo fmt --all --check`


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