asolimando opened a new pull request, #26051: URL: https://github.com/apache/datafusion/pull/26051
## Which issue does this PR close? - Closes #26050. ## Rationale for this change `CoalescePartitionsExec::cardinality_effect` returns `CardinalityEffect::Equal` even when `fetch` is set, although the operator can then produce fewer rows than its input. Code that relies on `cardinality_effect` gets the wrong answer, for example `PassthroughStatisticsProvider` reports the input row count and drops the fetch. ## What changes are included in this PR? - `CoalescePartitionsExec::cardinality_effect` returns `CardinalityEffect::LowerEqual` when `fetch` is set, as `SortExec` and `SortPreservingMergeExec` already do. ## What is the testing strategy for this PR? - New unit test for `cardinality_effect` with and without `fetch`. - New unit test showing that `PassthroughStatisticsProvider` no longer drops the fetch (`Exact(10)` instead of `Exact(1000)`). - `sqllogictest` and the core `physical_optimizer` integration tests pass with no plan changes. ## Are there any user-facing changes? No. ---- Disclaimer: I used AI to assist in the code generation, I have manually reviewed the output and it matches my intention and understanding. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
