You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2026/05/07 21:29:27 UTC

[PR] deprecate: mark Statistics V2 framework (PR #14699) as deprecated [datafusion]

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

   ## Which issue does this PR close?
   
   - Related to #14896
   - Related to #21120
   
   ## Rationale for this change
   
   The "Statistics V2" framework introduced in #14699 (`Distribution` enum,
   `PhysicalExpr::evaluate_statistics`/`propagate_statistics`,
   `ExprStatisticsGraph`, and supporting helpers in
   `datafusion-expr-common::statistics`) was always intended as the foundation
   for replacing `Precision`-based column statistics with richer probabilistic
   distributions (see #14896). In practice it has never been wired into the
   optimizer or any execution operator.
   
   PR #14699 was merged on 2025-02-24, ~15 months ago. Since then, the only
   commits touching `datafusion/expr-common/src/statistics.rs` and
   `datafusion/physical-expr/src/statistics/` have been mechanical
   (Rust-edition migrations, lint-driven refactors, renames of unrelated
   `Interval` constants, removal of `as_any`) — no operator or planner has
   been taught to call `evaluate_statistics` / `propagate_statistics` or
   construct a `Distribution` outside of the framework's own tests.
   
   Meanwhile, #21120 lays out a different, simpler direction: a pluggable
   `ExpressionAnalyzer` chain-of-responsibility for expression-level
   statistics. That issue explicitly describes the V2 distribution-based API
   as "significantly more complex to implement and adopt" and proposes that
   distribution-based estimation, if useful, be plugged in later as a custom
   analyzer rather than as a `PhysicalExpr` trait surface.
   
   Rather than continue carrying an unused public framework that we don't
   intend to build on, this PR deprecates it so downstream users don't start
   building on top of it before it is removed.
   
   ## What changes are included in this PR?
   
   This PR adds `#[deprecated(since = "54.0.0", ...)]` attributes to the
   public abstractions introduced in #14699 — the `Distribution` enum and its
   variant structs, the `evaluate_statistics` / `propagate_statistics` trait
   methods on `PhysicalExpr`, `ExprStatisticsGraph` /
   `ExprStatisticsGraphNode`, and the supporting helper functions — and
   updates internal callers to silence the resulting deprecation warnings
   (with `#[expect(deprecated)]` or module-level `#![allow(deprecated)]` where
   appropriate). The deprecation note on each item points to #21120 for the
   new direction.
   
   No behavior changes; the V2 code paths still compile and run, so any
   out-of-tree consumer that has already adopted them sees a deprecation
   warning rather than a breakage.
   
   ## Are these changes tested?
   
   No new tests; the existing tests for the deprecated items continue to
   pass.
   
   ## Are there any user-facing changes?
   
   The public API items listed above are now marked `#[deprecated]`.
   Downstream code that uses them will see a compiler warning pointing to
   #21120, but will continue to compile and run unchanged. The deprecated
   items will be removed in a future release.
   
   🤖 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: 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] deprecate: mark Statistics V2 framework (PR #14699) as deprecated [datafusion]

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

   As this has been open for several days and announced on the mailing list https://lists.apache.org/thread/mbw6q0ccndn2xq0kq8f28jrj5wppzqdn I will merge it in now. 
   
   Thank you all for your comments and discussion


-- 
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] deprecate: mark Statistics V2 framework (PR #14699) as deprecated [datafusion]

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

   > Maybe you already did this, but it would be a good idea to probe the community to see if somebody is using it or extending it. If nobody does that, this decision would be safe to go forward. If they built something on it, maybe they can contribute it upstream and it will get meaningful usage.
   
   I will send a note out to the broader community (mailing list and discord). I was thinking that by deprecating this for a while before removing it that would give a good signal to downstream users we were going to remove it and give them a chance to comment / let us know they were using it


-- 
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] deprecate: mark Statistics V2 framework (PR #14699) as deprecated [datafusion]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22071:
URL: https://github.com/apache/datafusion/pull/22071#issuecomment-4401345129

   <!-- semver-check-comment -->
   Thank you for opening this pull request!
   
   Reviewer note: [cargo-semver-checks](https://github.com/obi1kenobi/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>
   <summary>Details</summary>
   
   ```
        Cloning apache/main
       Building datafusion-expr-common v53.1.0 (current)
          Built [  23.078s] (current)
        Parsing datafusion-expr-common v53.1.0 (current)
         Parsed [   0.018s] (current)
       Building datafusion-expr-common v53.1.0 (baseline)
          Built [  18.673s] (baseline)
        Parsing datafusion-expr-common v53.1.0 (baseline)
         Parsed [   0.018s] (baseline)
       Checking datafusion-expr-common v53.1.0 -> v53.1.0 (no change; assume patch)
        Checked [   0.209s] 222 checks: 220 pass, 2 fail, 0 warn, 30 skip
   
   --- failure function_marked_deprecated: function #[deprecated] added ---
   
   Description:
   A function is now #[deprecated]. Downstream crates will get a compiler warning when using this function.
           ref: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
          impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/function_marked_deprecated.ron
   
   Failed in:
     function datafusion_expr_common::statistics::compute_mean in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:830
     function datafusion_expr_common::statistics::create_bernoulli_from_comparison in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:729
     function datafusion_expr_common::statistics::compute_median in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:866
     function datafusion_expr_common::statistics::combine_bernoullis in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:642
     function datafusion_expr_common::statistics::new_generic_from_binary_op in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:811
     function datafusion_expr_common::statistics::compute_variance in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:907
     function datafusion_expr_common::statistics::combine_gaussians in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:701
   
   --- failure type_marked_deprecated: #[deprecated] added on type ---
   
   Description:
   A type is now #[deprecated]. Downstream crates will get a compiler warning when using this type.
           ref: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
          impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/type_marked_deprecated.ron
   
   Failed in:
     Struct GaussianDistribution in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:286
     Struct BernoulliDistribution in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:300
     Struct GenericDistribution in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:313
     Struct UniformDistribution in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:243
     Struct ExponentialDistribution in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:269
     Enum Distribution in /home/runner/work/datafusion/datafusion/datafusion/expr-common/src/statistics.rs:62
   
        Summary semver requires new minor version: 0 major and 2 minor checks failed
       Finished [  42.818s] datafusion-expr-common
       Building datafusion-ffi v53.1.0 (current)
          Built [  56.494s] (current)
        Parsing datafusion-ffi v53.1.0 (current)
         Parsed [   0.052s] (current)
       Building datafusion-ffi v53.1.0 (baseline)
          Built [  56.179s] (baseline)
        Parsing datafusion-ffi v53.1.0 (baseline)
         Parsed [   0.055s] (baseline)
       Checking datafusion-ffi v53.1.0 -> v53.1.0 (no change; assume patch)
        Checked [   0.207s] 222 checks: 222 pass, 30 skip
        Summary no semver update required
       Finished [ 114.693s] datafusion-ffi
       Building datafusion-physical-expr v53.1.0 (current)
          Built [  24.068s] (current)
        Parsing datafusion-physical-expr v53.1.0 (current)
         Parsed [   0.041s] (current)
       Building datafusion-physical-expr v53.1.0 (baseline)
          Built [  24.553s] (baseline)
        Parsing datafusion-physical-expr v53.1.0 (baseline)
         Parsed [   0.041s] (baseline)
       Checking datafusion-physical-expr v53.1.0 -> v53.1.0 (no change; assume patch)
        Checked [   0.294s] 222 checks: 221 pass, 1 fail, 0 warn, 30 skip
   
   --- failure type_marked_deprecated: #[deprecated] added on type ---
   
   Description:
   A type is now #[deprecated]. Downstream crates will get a compiler warning when using this type.
           ref: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
          impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/type_marked_deprecated.ron
   
   Failed in:
     Struct ExprStatisticsGraphNode in /home/runner/work/datafusion/datafusion/datafusion/physical-expr/src/statistics/stats_solver.rs:65
     Struct ExprStatisticsGraph in /home/runner/work/datafusion/datafusion/datafusion/physical-expr/src/statistics/stats_solver.rs:53
   
        Summary semver requires new minor version: 0 major and 1 minor checks failed
       Finished [  50.066s] datafusion-physical-expr
       Building datafusion-physical-expr-common v53.1.0 (current)
          Built [  19.194s] (current)
        Parsing datafusion-physical-expr-common v53.1.0 (current)
         Parsed [   0.018s] (current)
       Building datafusion-physical-expr-common v53.1.0 (baseline)
          Built [  19.487s] (baseline)
        Parsing datafusion-physical-expr-common v53.1.0 (baseline)
         Parsed [   0.019s] (baseline)
       Checking datafusion-physical-expr-common v53.1.0 -> v53.1.0 (no change; assume patch)
        Checked [   0.190s] 222 checks: 221 pass, 1 fail, 0 warn, 30 skip
   
   --- failure trait_method_marked_deprecated: trait method #[deprecated] added ---
   
   Description:
   A trait 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.47.0/src/lints/trait_method_marked_deprecated.ron
   
   Failed in:
     method evaluate_statistics in trait datafusion_physical_expr_common::physical_expr::PhysicalExpr in /home/runner/work/datafusion/datafusion/datafusion/physical-expr-common/src/physical_expr.rs:75
     method propagate_statistics in trait datafusion_physical_expr_common::physical_expr::PhysicalExpr in /home/runner/work/datafusion/datafusion/datafusion/physical-expr-common/src/physical_expr.rs:75
   
        Summary semver requires new minor version: 0 major and 1 minor checks failed
       Finished [  39.863s] datafusion-physical-expr-common
   ```
   
   </details>
   <!-- semver-check-comment -->


-- 
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] deprecate: mark Statistics V2 framework (PR #14699) as deprecated [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #22071:
URL: https://github.com/apache/datafusion/pull/22071


-- 
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