haohuaijin opened a new pull request, #21070: URL: https://github.com/apache/datafusion/pull/21070
## Which issue does this PR close? - Closes #21069 ## Rationale for this change - see #21069 ## What changes are included in this PR? When `FilterPushdown` merges/eliminates a `FilterExec`, it now correctly propagates the `fetch` limit that was on the FilterExec. Previously, if a `FilterExec` had a fetch (e.g., LIMIT 10) and all its predicates were fully pushed down to a under `FilterExec`, the FilterExec node was dropped — and the fetch was silently lost, potentially returning more rows than requested. The fix: - If the FilterExec being eliminated has a fetch, propagate it to the child node via `with_fetch()` (this still have the change to lost the fetch, if the child node do not support with_fetch) - If both the outer and inner nodes have a fetch, use min(outer, inner) to preserve the tighter constraint ## Are these changes tested? yes, add some test cases, try to reproduce use sql ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> -- 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]
