You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "discord9 (via GitHub)" <gi...@apache.org> on 2026/09/08 11:45:09 UTC

[PR] fix: preserve file scan fetch during filter pushdown [datafusion]

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

   ## Which issue does this PR close?
   
   No linked issue. This is an independently reproduced physical-optimizer correctness fix.
   
   ## Rationale for this change
   
   A new parent predicate must not be moved below an already-enforced file-scan fetch. For an ordered Parquet scan containing `[0, 1]`, `Filter(a = 1) → Scan(fetch=1)` returns no rows. Filter pushdown currently installs the predicate inside the capped scan, changing the result to `[1]`.
   
   This was reproduced through the physical-plan API, isolated FilterPushdown, and one/two complete default physical-optimizer passes. An ordinary SQL-planning reproduction is not established here.
   
   ## What changes are included in this PR?
   
   Reject new parent predicates at `FileScanConfig::try_pushdown_filters` when the scan already has a limit, using the existing unsupported propagation result without updating the source. This preserves existing source predicates and prevents admission through the pruning-only path as well as exact row filtering. Uncapped scans retain their existing filter-pushdown behavior.
   
   The production change is one source-local guard; no new configuration or optimizer machinery. This is independent of #23800 and #25065.
   
   ## What is the testing strategy for this PR?
   
   Two focused Parquet tests cover:
   
   - an ordered single-row-group scan with row filtering enabled and statistics pruning disabled, including fetch 1 and 0;
   - original/optimized results and one/two full optimizer passes;
   - uncapped exact filter pushdown;
   - pruning-only predicate admission and preservation of an existing internal scan predicate.
   
   Removing only the guard makes the row-filtering regression return `[1]` instead of `[]`. The pruning-only ablation fails the no-new-predicate plan assertion; it is not claimed as a separate wrong-row reproduction. The production guard was restored byte-exactly.
   
   Verified locally:
   
   - `cargo check -p datafusion-datasource`
   - `cargo test -p datafusion --test parquet_integration parquet::filter_pushdown::` — 10 passed
   - `cargo fmt --all --check`
   - `cargo clippy --workspace --all-targets --all-features -- -D warnings`
   
   The full workspace runtime test suite was not run.
   
   ## Are there any user-facing changes?
   
   Preserves results when optimizing an already-capped file scan beneath a parent filter. No public API or configuration changes. This conservatively declines new predicate pushdown at an existing scan limit rather than changing the scan's current predicate semantics.
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: preserve file scan fetch during filter pushdown [datafusion]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #25067:
URL: https://github.com/apache/datafusion/pull/25067#issuecomment-5587122772

   ## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/25067?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 81.74%. Comparing base ([`b39cb4a`](https://app.codecov.io/gh/apache/datafusion/commit/b39cb4a549bfa7b5619cbd16d060a2737b12c6cd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`67f3e65`](https://app.codecov.io/gh/apache/datafusion/commit/67f3e6543e7e6f5efe33346e1b9b2f13b01bd9dd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on main.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##             main   #25067      +/-   ##
   ==========================================
   - Coverage   81.74%   81.74%   -0.01%     
   ==========================================
     Files        1128     1128              
     Lines      416644   416649       +5     
     Branches   416644   416649       +5     
   ==========================================
   - Hits       340585   340584       -1     
   - Misses      55999    56005       +6     
     Partials    20060    20060              
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/25067?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: preserve file scan fetch during filter pushdown [datafusion]

Posted by "discord9 (via GitHub)" <gi...@apache.org>.
discord9 closed pull request #25067: fix: preserve file scan fetch during filter pushdown
URL: https://github.com/apache/datafusion/pull/25067


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org