You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fe1dd57
Browse filesBrowse the repository at this point in the historyBrowse files
## Which issue does this PR close?
- Closes to apache#14896
- Related to apache#21120
## Rationale for this change
I think the fact that we have 2 sets of statics functions is confusing.
I think we should mark the copy that is not used as deprecated.
A bit over a year ago, thanks to @Fly-Style and @ozankabak, DataFusion
we merged a PR with a "V2" statistics framework
- apache#14699
The work to migrate the code to use this new framework is tracked in a
follow on ticket
- apache#14896
Sadly, no progress seems to have been made in this migration in over a
year.
PR apache#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 — no
operator or planner has been taught to call `evaluate_statistics` /
`propagate_statistics` or construct a `Distribution` outside of the
framework's own tests.
In practice it has never been wired into the optimizer or any execution
operator.
Recently, thanks to @asolimando we have been starting down a different
path of a more extensible system:
- apache#21120
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, let's deprecate it so downstream users aren't
confused
## What changes are included in this PR?
This PR adds `#[deprecated(since = "54.0.0", ...)]` attributes to the
public abstractions introduced in apache#1469
There is 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
apache#21120, but will continue to compile and run unchanged. The deprecated
items will be removed in a future release.
Partly generated 🤖 Generated with [Claude
Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
/// is the main unit of calculus when evaluating expressions in a statistical
38
48
/// context. Notions like column and table statistics are built on top of this
39
49
/// object and the operations it supports.
50
+
#[deprecated(
51
+
since = "54.0.0",
52
+
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
304
+
)]
271
305
#[derive(Clone,Debug,PartialEq)]
272
306
pubstructGenericDistribution{
273
307
mean:ScalarValue,
@@ -594,6 +628,10 @@ impl GenericDistribution {
594
628
/// This function takes a logical operator and two Bernoulli distributions,
595
629
/// and it returns a new Bernoulli distribution that represents the result of
596
630
/// the operation. Currently, only `AND` and `OR` operations are supported.
631
+
#[deprecated(
632
+
since = "54.0.0",
633
+
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
693
+
)]
652
694
pubfncombine_gaussians(
653
695
op:&Operator,
654
696
left:&GaussianDistribution,
@@ -673,6 +715,10 @@ pub fn combine_gaussians(
673
715
/// Expects `op` to be a comparison operator, with `left` and `right` having
674
716
/// numeric distributions. The resulting distribution has the `Float64` data
675
717
/// type.
718
+
#[deprecated(
719
+
since = "54.0.0",
720
+
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
/// given binary operation on two unknown quantities represented by their
752
798
/// [`Distribution`] objects. The function computes the mean, median and
753
799
/// variance if possible.
800
+
#[deprecated(
801
+
since = "54.0.0",
802
+
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
/// Computes the mean value for the result of the given binary operation on
768
818
/// two unknown quantities represented by their [`Distribution`] objects.
819
+
#[deprecated(
820
+
since = "54.0.0",
821
+
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
822
+
)]
769
823
pubfncompute_mean(
770
824
op:&Operator,
771
825
left:&Distribution,
@@ -798,6 +852,10 @@ pub fn compute_mean(
798
852
/// the median is calculable only for addition and subtraction operations on:
799
853
/// - [`Uniform`] and [`Uniform`] distributions, and
800
854
/// - [`Gaussian`] and [`Gaussian`] distributions.
855
+
#[deprecated(
856
+
since = "54.0.0",
857
+
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
858
+
)]
801
859
pubfncompute_median(
802
860
op:&Operator,
803
861
left:&Distribution,
@@ -835,6 +893,10 @@ pub fn compute_median(
835
893
836
894
/// Computes the variance value for the result of the given binary operation on
837
895
/// two unknown quantities represented by their [`Distribution`] objects.
896
+
#[deprecated(
897
+
since = "54.0.0",
898
+
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
/// statistics accordingly. The default implementation simply creates an
251
252
/// unknown output distribution by combining input ranges. This logic loses
252
253
/// distribution information, but is a safe default.
254
+
#[deprecated(
255
+
since = "54.0.0",
256
+
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
/// default implementation simply creates an unknown distribution if it can
299
305
/// narrow the range by propagating ranges. This logic loses distribution
300
306
/// information, but is a safe default.
307
+
#[deprecated(
308
+
since = "54.0.0",
309
+
note = "Part of the unused Statistics V2 framework; see https://github.com/apache/datafusion/pull/22071"
0 commit comments