diff --git a/vortex-array/src/stats/rewrite/builtins.rs b/vortex-array/src/stats/rewrite/builtins.rs
index 3476c053ecf..2b7316c7d98 100644
--- a/vortex-array/src/stats/rewrite/builtins.rs
+++ b/vortex-array/src/stats/rewrite/builtins.rs
@@ -84,15 +84,15 @@ impl StatsRewriteRule for BinaryStatsRewrite {
Ok(match operator {
Operator::Eq => {
- let left = min(lhs).zip(max(rhs)).map(|(a, b)| gt(a, b));
- let right = min(rhs).zip(max(lhs)).map(|(a, b)| gt(a, b));
+ let left = min(lhs, ctx).zip(max(rhs, ctx)).map(|(a, b)| gt(a, b));
+ let right = min(rhs, ctx).zip(max(lhs, ctx)).map(|(a, b)| gt(a, b));
or_collect(left.into_iter().chain(right))
.map(|value_predicate| with_nan_predicate(ctx, lhs, rhs, value_predicate))
.transpose()?
}
- Operator::NotEq => min(lhs)
- .zip(max(rhs))
- .zip(max(lhs).zip(min(rhs)))
+ Operator::NotEq => min(lhs, ctx)
+ .zip(max(rhs, ctx))
+ .zip(max(lhs, ctx).zip(min(rhs, ctx)))
.map(|((min_lhs, max_rhs), (max_lhs, min_rhs))| {
with_nan_predicate(
ctx,
@@ -102,20 +102,20 @@ impl StatsRewriteRule for BinaryStatsRewrite {
)
})
.transpose()?,
- Operator::Gt => max(lhs)
- .zip(min(rhs))
+ Operator::Gt => max(lhs, ctx)
+ .zip(min(rhs, ctx))
.map(|(a, b)| with_nan_predicate(ctx, lhs, rhs, lt_eq(a, b)))
.transpose()?,
- Operator::Gte => max(lhs)
- .zip(min(rhs))
+ Operator::Gte => max(lhs, ctx)
+ .zip(min(rhs, ctx))
.map(|(a, b)| with_nan_predicate(ctx, lhs, rhs, lt(a, b)))
.transpose()?,
- Operator::Lt => min(lhs)
- .zip(max(rhs))
+ Operator::Lt => min(lhs, ctx)
+ .zip(max(rhs, ctx))
.map(|(a, b)| with_nan_predicate(ctx, lhs, rhs, gt_eq(a, b)))
.transpose()?,
- Operator::Lte => min(lhs)
- .zip(max(rhs))
+ Operator::Lte => min(lhs, ctx)
+ .zip(max(rhs, ctx))
.map(|(a, b)| with_nan_predicate(ctx, lhs, rhs, gt(a, b)))
.transpose()?,
Operator::And => {
@@ -167,17 +167,17 @@ impl StatsRewriteRule for IsNullLegacyStatsRewrite {
fn falsify(
&self,
expr: &Expression,
- _ctx: &StatsRewriteCtx<'_>,
+ ctx: &StatsRewriteCtx<'_>,
) -> VortexResult