Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ jobs:
with:
sccache: s3
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: "corretto"
java-version: "17"
- uses: ./.github/actions/setup-prebuild
- run: ./gradlew javadoc
working-directory: ./java
Expand Down
46 changes: 0 additions & 46 deletions vortex-array/src/expr/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ use vortex_error::vortex_ensure;
use vortex_session::VortexSession;

use crate::dtype::DType;
use crate::expr::StatsCatalog;
use crate::expr::display::DisplayTreeExpr;
use crate::expr::stats::Stat;
use crate::scalar_fn::ScalarFnRef;
use crate::scalar_fn::fns::root::Root;

Expand Down Expand Up @@ -114,28 +112,6 @@ impl Expression {
self.scalar_fn.validity(self)
}

/// An expression over zone-statistics which implies all records in the zone evaluate to false.
///
/// Given an expression, `e`, if `e.stat_falsification(..)` evaluates to true, it is guaranteed
/// that `e` evaluates to false on all records in the zone. However, the inverse is not
/// necessarily true: even if the falsification evaluates to false, `e` need not evaluate to
/// true on all records.
///
/// The [`StatsCatalog`] can be used to constrain or rename stats used in the final expr.
///
/// # Examples
///
/// - An expression over one variable: `x > 0` is false for all records in a zone if the maximum
/// value of the column `x` in that zone is less than or equal to zero: `max(x) <= 0`.
/// - An expression over two variables: `x > y` becomes `max(x) <= min(y)`.
/// - A conjunctive expression: `x > y AND z < x` becomes `max(x) <= min(y) OR min(z) >= max(x).
///
/// Some expressions, in theory, have falsifications but this function does not support them
/// such as `x < (y < z)` or `x LIKE "needle%"`.
pub fn stat_falsification(&self, catalog: &dyn StatsCatalog) -> Option<Expression> {
self.scalar_fn().stat_falsification(self, catalog)
}

/// Returns an expression that proves this predicate is definitely false from stats.
///
/// `scope` is the dtype of the row this expression evaluates over.
Expand Down Expand Up @@ -164,28 +140,6 @@ impl Expression {
crate::stats::rewrite::StatsRewriteCtx::new(session, scope).satisfy(self)
}

/// Returns an expression representing the zoned statistic for the given stat, if available.
///
/// The [`StatsCatalog`] returns expressions that can be evaluated using the zone map as a
/// scope. Expressions can implement this function to propagate such statistics through the
/// expression tree. For example, the `a + 10` expression could propagate `min: min(a) + 10`.
///
/// NOTE(gatesn): we currently cannot represent statistics over nested fields. Please file an
/// issue to discuss a solution to this.
pub fn stat_expression(&self, stat: Stat, catalog: &dyn StatsCatalog) -> Option<Expression> {
self.scalar_fn().stat_expression(self, stat, catalog)
}

/// Returns an expression representing the zoned maximum statistic, if available.
pub fn stat_min(&self, catalog: &dyn StatsCatalog) -> Option<Expression> {
self.stat_expression(Stat::Min, catalog)
}

/// Returns an expression representing the zoned maximum statistic, if available.
pub fn stat_max(&self, catalog: &dyn StatsCatalog) -> Option<Expression> {
self.stat_expression(Stat::Max, catalog)
}

/// Format the expression as a compact string.
///
/// Since this is a recursive formatter, it is exposed on the public Expression type.
Expand Down
1 change: 0 additions & 1 deletion vortex-array/src/expr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ pub mod traversal;
pub use analysis::*;
pub use expression::*;
pub use exprs::*;
pub use pruning::StatsCatalog;

pub trait VortexExprExt {
/// Accumulate all field references from this expression and its children in a set
Expand Down
17 changes: 0 additions & 17 deletions vortex-array/src/expr/pruning/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,3 @@ pub use pruning_expr::RequiredStats;
pub use pruning_expr::checked_pruning_expr;
pub use pruning_expr::field_path_stat_field_name;
pub use relation::Relation;

use crate::dtype::FieldPath;
use crate::expr::Expression;
use crate::expr::stats::Stat;

/// A catalog of available stats that are associated with field paths.
pub trait StatsCatalog {
/// Given a field path and statistic, return an expression that when evaluated over the catalog
/// will return that stat for the referenced field.
///
/// This is likely to be a column expression, or a literal.
///
/// Returns `None` if the stat is not available for the field path.
fn stats_ref(&self, _field_path: &FieldPath, _stat: Stat) -> Option<Expression> {
None
}
}
Loading
Loading