kosiew opened a new issue, #27676: URL: https://github.com/apache/datafusion/issues/27676
# Related PR #26852 ## Problem `CoalescePartitionsExec::compute_properties` calls `clear_orderings()` regardless of input partition count. This already discarded ordering; after #26852, it also discards explicit grouping assertions and their normalized cache. With one input partition, `execute` forwards the child stream directly or returns its prefix when `fetch` is set. Neither operation rearranges rows or splits a group into separate runs. ## Why it matters Downstream planning can no longer use valid ordering or grouping guarantees across the single-partition fast path. The current behavior is conservative: no wrong results or measured performance regression are claimed. ## Invariant / desired behavior Single-partition coalesce preserves the child's ordering and grouping guarantees, with or without `fetch`. Fetch may shorten the final retained group or omit later groups, but retained rows stay in order and equal-key runs stay contiguous. With multiple input partitions, coalesce must not carry forward child ordering or explicit grouping guarantees: interleaving streams can break both. ## Proposed direction In `datafusion/physical-plan/src/coalesce_partitions.rs`, skip `clear_orderings()` only for exactly one input partition. Keep per-partition constant handling, output partitioning, scheduling, evaluation type, and other plan-property handling unchanged. Leave the shared `EquivalenceProperties::clear_orderings()` contract intact. ## Scope ### In - Sequence-property handling and focused tests for `CoalescePartitionsExec`. ### Out - Changes to execution, fetch semantics, other operators, or the shared invalidation helper. - The separate direct helper test proposed in review suggestion 2. ## Acceptance criteria - [ ] With one input partition, both plain coalesce and fetch-limited coalesce advertise valid child ordering and explicit grouping. Fetch still returns the same prefix. - [ ] With multiple input partitions, coalesce does not advertise child ordering or explicit grouping that interleaving could invalidate. ## Tests / verification - Update the existing `coalesce_clears_explicit_grouping` coverage so it still checks multi-partition clearing but no longer expects single-partition clearing. - Add focused cases for one partition without fetch, one partition with fetch cutting a group short, and multiple partitions. Use explicit grouping on a key independent of the advertised ordering so an ordering-derived proof cannot mask lost explicit grouping. Assert ordering and grouping separately; verify the fetched output against the expected prefix. - Run `cargo test -p datafusion-physical-plan --lib coalesce_partitions::tests`. -- 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]
