Skip to content

Commit dc53bef

Browse files
committed
Use binary compute over datums
Signed-off-by: Nicholas Gates <[email protected]>
1 parent d90bbda commit dc53bef

File tree

4 files changed

+5
-29
lines changed

4 files changed

+5
-29
lines changed

vortex-array/src/arrays/scalar_fn/rules/abstract_reduce.rs

Whitespace-only changes.

vortex-array/src/arrays/scalar_fn/rules/constant.rs

Whitespace-only changes.

vortex-array/src/arrays/scalar_fn/rules.rs renamed to vortex-array/src/arrays/scalar_fn/rules/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use crate::optimizer::rules::ArrayReduceRule;
3030
use crate::optimizer::rules::ReduceRuleSet;
3131

3232
pub(super) const RULES: ReduceRuleSet<ScalarFnVTable> =
33-
ReduceRuleSet::new(&[&ScalarFnConstantRule, &ScalarFnAbstractReduceRule]);
33+
ReduceRuleSet::new(&[&ScalarFnConstantRule, &ScalarFnAbstractReduceRule, ]);
3434

3535
#[derive(Debug)]
3636
struct ScalarFnConstantRule;

vortex-array/src/expr/exprs/binary.rs

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use arrow_ord::cmp;
77
use prost::Message;
88
use vortex_compute::arrow::IntoArrow;
99
use vortex_compute::arrow::IntoVector;
10+
use vortex_compute::logical::LogicalAndKleene;
11+
use vortex_compute::logical::LogicalOrKleene;
1012
use vortex_dtype::DType;
1113
use vortex_error::VortexExpect;
1214
use vortex_error::VortexResult;
@@ -136,36 +138,10 @@ impl VTable for Binary {
136138

137139
match op {
138140
Operator::And => {
139-
// FIXME(ngates): implement logical compute over datums
140-
let lhs = lhs
141-
.unwrap_into_vector(args.row_count)
142-
.into_bool()
143-
.into_arrow()?;
144-
let rhs = rhs
145-
.unwrap_into_vector(args.row_count)
146-
.into_bool()
147-
.into_arrow()?;
148-
return Ok(Datum::Vector(
149-
arrow_arith::boolean::and_kleene(&lhs, &rhs)?
150-
.into_vector()?
151-
.into(),
152-
));
141+
return Ok(LogicalAndKleene::and_kleene(&lhs.into_bool(), &rhs.into_bool()).into());
153142
}
154143
Operator::Or => {
155-
// FIXME(ngates): implement logical compute over datums
156-
let lhs = lhs
157-
.unwrap_into_vector(args.row_count)
158-
.into_bool()
159-
.into_arrow()?;
160-
let rhs = rhs
161-
.unwrap_into_vector(args.row_count)
162-
.into_bool()
163-
.into_arrow()?;
164-
return Ok(Datum::Vector(
165-
arrow_arith::boolean::or_kleene(&lhs, &rhs)?
166-
.into_vector()?
167-
.into(),
168-
));
144+
return Ok(LogicalOrKleene::or_kleene(&lhs.into_bool(), &rhs.into_bool()).into());
169145
}
170146
_ => {}
171147
}

0 commit comments

Comments
 (0)