Skip to content

refactor(pruning): deprecate PruningPredicate::try_new - #24129

Open
goutamadwant wants to merge 2 commits into
apache:mainfrom
goutamadwant:gh-24128-pruning-predicate-builder
Open

refactor(pruning): deprecate PruningPredicate::try_new#24129
goutamadwant wants to merge 2 commits into
apache:mainfrom
goutamadwant:gh-24128-pruning-predicate-builder

Conversation

@goutamadwant

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

PruningPredicateBuilder is the extensible entry point for constructing pruning predicates, but the construction logic still lived behind PruningPredicate::try_new. Keeping the logic in the builder provides one place to add future construction options and guides callers toward the extensible API.

What changes are included in this PR?

  • Move pruning predicate construction into PruningPredicateBuilder::try_build.
  • Deprecate PruningPredicate::try_new and retain it as a compatibility wrapper using the builder defaults.
  • Migrate DataFusion call sites and examples to PruningPredicateBuilder.
  • Add a regression test confirming the deprecated constructor and builder produce equivalent predicates.

Are these changes tested?

Yes. The following checks pass:

  • cargo fmt --all -- --check
  • cargo test -p datafusion-pruning
  • cargo test -p datafusion-datasource-parquet
  • cargo check -p datafusion-examples --examples
  • cargo clippy -p datafusion-pruning -p datafusion-datasource-parquet -p datafusion-examples --all-targets --all-features -- -D warnings
  • cargo test --profile=ci --test sqllogictests
  • cargo test -p datafusion
  • cargo test -p datafusion-cli
  • RUSTDOCFLAGS="-D warnings" cargo doc -p datafusion-pruning --no-deps

The workspace-wide clippy command is currently blocked on main by an existing clippy::uninlined_format_args diagnostic in datafusion/proto-common/src/generated/pbjson.rs. The same failure reproduces from a clean checkout of the base commit; all modified packages pass strict clippy checks.

Are there any user-facing changes?

Yes. PruningPredicate::try_new is deprecated as of 55.0.0. It remains available as a compatibility wrapper with unchanged behavior. New callers should construct predicates with PruningPredicateBuilder.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Thank you for opening this pull request!

Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).

Details
     Cloning apache/main
    Building datafusion-datasource-parquet v54.1.0 (current)
       Built [  44.371s] (current)
     Parsing datafusion-datasource-parquet v54.1.0 (current)
      Parsed [   0.031s] (current)
    Building datafusion-datasource-parquet v54.1.0 (baseline)
       Built [  43.984s] (baseline)
     Parsing datafusion-datasource-parquet v54.1.0 (baseline)
      Parsed [   0.031s] (baseline)
    Checking datafusion-datasource-parquet v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.151s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [  89.849s] datafusion-datasource-parquet
    Building datafusion-pruning v54.1.0 (current)
       Built [  38.698s] (current)
     Parsing datafusion-pruning v54.1.0 (current)
      Parsed [   0.012s] (current)
    Building datafusion-pruning v54.1.0 (baseline)
       Built [  38.933s] (baseline)
     Parsing datafusion-pruning v54.1.0 (baseline)
      Parsed [   0.013s] (baseline)
    Checking datafusion-pruning v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.071s] 223 checks: 222 pass, 1 fail, 0 warn, 30 skip

--- failure type_method_marked_deprecated: type method #[deprecated] added ---

Description:
A type method is now #[deprecated]. Downstream crates will get a compiler warning when using this method.
        ref: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.49.0/src/lints/type_method_marked_deprecated.ron

Failed in:
  method datafusion_pruning::PruningPredicate::try_new in /home/runner/work/datafusion/datafusion/datafusion/pruning/src/pruning_predicate.rs:598

     Summary semver requires new minor version: 0 major and 1 minor checks failed
    Finished [  79.083s] datafusion-pruning

@github-actions github-actions Bot added the auto detected api change Auto detected API change label Aug 6, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.32710% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.04%. Comparing base (f27e50c) to head (9af8bcc).

Files with missing lines Patch % Lines
datafusion/pruning/src/pruning_predicate.rs 92.42% 0 Missing and 5 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #24129   +/-   ##
=======================================
  Coverage   81.04%   81.04%           
=======================================
  Files        1105     1105           
  Lines      380092   380132   +40     
  Branches   380092   380132   +40     
=======================================
+ Hits       308041   308074   +33     
- Misses      53835    53837    +2     
- Partials    18216    18221    +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zhuqi-lucas

Copy link
Copy Markdown
Contributor

Should we add upgrade guide also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto detected api change Auto detected API change datasource Changes to the datasource crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate PruningPredicate::try_new in favor of PruningPredicateBuilder

3 participants