Skip to content

Commit b2e0aaf

Browse files
committed
Implement validity for Between scalar function
Signed-off-by: Robert Kruszewski <github@robertk.io>
1 parent 47f1158 commit b2e0aaf

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

  • vortex-array/src/scalar_fn/fns/between

vortex-array/src/scalar_fn/fns/between/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::fmt::Formatter;
88

99
pub use kernel::*;
1010
use prost::Message;
11+
use vortex_array::expr::and;
1112
use vortex_error::VortexResult;
1213
use vortex_error::vortex_bail;
1314
use vortex_proto::expr as pb;
@@ -308,9 +309,18 @@ impl ScalarFnVTable for Between {
308309
let lhs = Binary.new_expr(options.lower_strict.to_operator(), [lower, arr.clone()]);
309310
let rhs = Binary.new_expr(options.upper_strict.to_operator(), [arr, upper]);
310311

311-
Binary
312-
.new_expr(Operator::And, [lhs, rhs])
313-
.stat_falsification(catalog)
312+
and(lhs, rhs).stat_falsification(catalog)
313+
}
314+
315+
fn validity(
316+
&self,
317+
_options: &Self::Options,
318+
expression: &Expression,
319+
) -> VortexResult<Option<Expression>> {
320+
let arr = expression.child(0).validity()?;
321+
let lower = expression.child(1).validity()?;
322+
let upper = expression.child(2).validity()?;
323+
Ok(Some(and(and(arr, lower), upper)))
314324
}
315325

316326
fn is_null_sensitive(&self, _instance: &Self::Options) -> bool {

0 commit comments

Comments
 (0)