Skip to content

Commit 8c2bdfd

Browse files
committed
(fix) resolve pending rebase errors/compatibility issues
Signed-off-by: Joaquin Colacci <joaquincolacci@gmail.com>
1 parent a76bdc4 commit 8c2bdfd

3 files changed

Lines changed: 21 additions & 46 deletions

File tree

vortex-array/src/stats/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn stat(expr: Expression, aggregate_fn: AggregateFnRef) -> Expression {
3131
StatFn.new_expr(StatOptions::new(aggregate_fn), [expr])
3232
}
3333

34-
fn bound_stat(expr: BoundExpression, aggregate_fn: AggregateFnRef) -> BoundExpression {
34+
pub fn bound_stat(expr: BoundExpression, aggregate_fn: AggregateFnRef) -> BoundExpression {
3535
StatFn
3636
.try_new_bound_expr(StatOptions::new(aggregate_fn), [expr])
3737
.vortex_expect("stat expressions must use an aggregate supported by the child dtype")

vortex-layout/src/layouts/zoned/aggregates/mod.rs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,9 @@ use std::sync::Arc;
88
use vortex_array::aggregate_fn::AggregateFnRef;
99
use vortex_array::aggregate_fn::AggregateFnVTableExt;
1010
use vortex_array::aggregate_fn::EmptyOptions;
11-
use vortex_array::aggregate_fn::NumericalAggregateOpts;
12-
use vortex_array::aggregate_fn::fns::bounded_max::BoundedMax;
13-
use vortex_array::aggregate_fn::fns::bounded_max::BoundedMaxOptions;
14-
use vortex_array::aggregate_fn::fns::bounded_min::BoundedMin;
15-
use vortex_array::aggregate_fn::fns::bounded_min::BoundedMinOptions;
16-
use vortex_array::aggregate_fn::fns::max::Max;
17-
use vortex_array::aggregate_fn::fns::min::Min;
1811
use vortex_array::aggregate_fn::fns::nan_count::NanCount;
1912
use vortex_array::aggregate_fn::fns::null_count::NullCount;
13+
use vortex_array::aggregate_fn::session::AggregateFnSessionExt;
2014
use vortex_array::dtype::DType;
2115
use vortex_session::VortexSession;
2216

@@ -27,26 +21,13 @@ pub(in crate::layouts::zoned) use bloom_filter::BloomFilter;
2721
pub(in crate::layouts::zoned) use bloom_filter::bloom_contains;
2822
pub(in crate::layouts::zoned) use bloom_filter::i64_value;
2923

30-
use crate::layouts::zoned::schema::default_bounded_stat_max_bytes;
24+
use crate::layouts::zoned::aggregates::min_max::min_max_aggregate_fns;
3125

3226
pub(super) fn default_zoned_aggregate_fns(
3327
dtype: &DType,
3428
session: &VortexSession,
3529
) -> Arc<[AggregateFnRef]> {
36-
let (max, min) = match dtype {
37-
DType::Utf8(_) | DType::Binary(_) => (
38-
BoundedMax.bind(BoundedMaxOptions {
39-
max_bytes: default_bounded_stat_max_bytes(),
40-
}),
41-
BoundedMin.bind(BoundedMinOptions {
42-
max_bytes: default_bounded_stat_max_bytes(),
43-
}),
44-
),
45-
_ => (
46-
Max.bind(NumericalAggregateOpts::skip_nans()),
47-
Min.bind(NumericalAggregateOpts::skip_nans()),
48-
),
49-
};
30+
let [max, min] = min_max_aggregate_fns(dtype);
5031

5132
// Sum is deliberately absent: zone maps exist to prune, and a zone sum prunes nothing.
5233
// Its semantics are also unsettled - null-on-empty was changed in #9113 and reverted in

vortex-layout/src/layouts/zoned/skip_index/bloom.rs

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ use vortex_array::arrays::varbinview::VarBinViewArrayExt;
1717
use vortex_array::dtype::DType;
1818
use vortex_array::dtype::Nullability;
1919
use vortex_array::dtype::PType;
20-
use vortex_array::expr::Expression;
21-
use vortex_array::expr::is_root;
22-
use vortex_array::expr::not;
20+
use vortex_array::expr::BoundExpression;
21+
use vortex_array::expr::bound::not;
2322
use vortex_array::scalar::Scalar;
2423
use vortex_array::scalar_fn::Arity;
2524
use vortex_array::scalar_fn::ChildName;
@@ -31,10 +30,10 @@ use vortex_array::scalar_fn::fns::binary::Binary;
3130
use vortex_array::scalar_fn::fns::literal::Literal;
3231
use vortex_array::scalar_fn::fns::operators::Operator;
3332
use vortex_array::scalar_fn::session::ScalarFnSessionExt;
33+
use vortex_array::stats::expr::bound_stat;
3434
use vortex_array::stats::rewrite::StatsRewriteCtx;
3535
use vortex_array::stats::rewrite::StatsRewriteRule;
3636
use vortex_array::stats::session::StatsSessionExt;
37-
use vortex_array::stats::stat;
3837
use vortex_buffer::BitBuffer;
3938
use vortex_error::VortexResult;
4039
use vortex_error::vortex_ensure;
@@ -167,10 +166,6 @@ impl ScalarFnVTable for BloomContains {
167166
Ok(BoolArray::new(BitBuffer::from_iter(possible), validity).into_array())
168167
}
169168

170-
fn is_null_sensitive(&self, _options: &Self::Options) -> bool {
171-
false
172-
}
173-
174169
fn is_fallible(&self, _options: &Self::Options) -> bool {
175170
false
176171
}
@@ -189,16 +184,16 @@ impl StatsRewriteRule for BloomEqRewrite {
189184

190185
fn falsify(
191186
&self,
192-
expr: &Expression,
187+
expr: &BoundExpression,
193188
ctx: &StatsRewriteCtx<'_>,
194-
) -> VortexResult<Option<Expression>> {
189+
) -> VortexResult<Option<BoundExpression>> {
195190
if *expr.as_::<Binary>() != Operator::Eq {
196191
return Ok(None);
197192
}
198193

199-
let (column, literal) = if is_root(expr.child(0)) && expr.child(1).is::<Literal>() {
194+
let (column, literal) = if expr.child(0).is_root() && expr.child(1).is::<Literal>() {
200195
(expr.child(0), expr.child(1))
201-
} else if is_root(expr.child(1)) && expr.child(0).is::<Literal>() {
196+
} else if expr.child(1).is_root() && expr.child(0).is::<Literal>() {
202197
(expr.child(1), expr.child(0))
203198
} else {
204199
return Ok(None);
@@ -209,8 +204,9 @@ impl StatsRewriteRule for BloomEqRewrite {
209204
return Ok(None);
210205
}
211206

212-
let filter = stat(column.clone(), BloomFilter.bind(self.options.clone()));
213-
let contains = BloomContains.new_expr(self.options.clone(), [filter, literal.clone()]);
207+
let filter = bound_stat(column.clone(), BloomFilter.bind(self.options.clone()));
208+
let contains =
209+
BloomContains.try_new_bound_expr(self.options.clone(), [filter, literal.clone()])?;
214210
Ok(Some(not(contains)))
215211
}
216212
}
@@ -225,9 +221,9 @@ mod tests {
225221
use vortex_array::dtype::DType;
226222
use vortex_array::dtype::Nullability;
227223
use vortex_array::dtype::PType;
228-
use vortex_array::expr::eq;
229-
use vortex_array::expr::lit;
230-
use vortex_array::expr::root;
224+
use vortex_array::expr::bound::eq;
225+
use vortex_array::expr::bound::lit;
226+
use vortex_array::expr::bound::root;
231227
use vortex_array::validity::Validity;
232228
use vortex_error::VortexResult;
233229

@@ -248,16 +244,14 @@ mod tests {
248244
let session = vortex_array::array_session();
249245
let index = BloomSkipIndex::new(small_options());
250246
index.register(&session);
251-
let predicate = eq(root(), lit(42i64));
247+
let dtype = DType::Primitive(PType::I64, Nullability::NonNullable);
248+
let predicate = eq(root(dtype.clone()), lit(42i64));
252249
let proof = predicate
253-
.falsify(
254-
&DType::Primitive(PType::I64, Nullability::NonNullable),
255-
&session,
256-
)?
250+
.falsify(&session)?
257251
.expect("equality has a bloom proof");
258252

259253
let zone_map = ZoneMap::try_new(
260-
DType::Primitive(PType::I64, Nullability::NonNullable),
254+
dtype,
261255
StructArray::try_new(Vec::<&str>::new().into(), vec![], 2, Validity::NonNullable)?,
262256
Arc::new([]),
263257
8,

0 commit comments

Comments
 (0)