Skip to content

Commit ca81664

Browse files
committed
feat[array]: dynamic expr
Signed-off-by: Joe Isaacs <[email protected]>
1 parent 8f85593 commit ca81664

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

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

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,29 +120,22 @@ impl VTable for DynamicComparison {
120120
}
121121

122122
fn execute(&self, data: &Self::Options, args: ExecutionArgs) -> VortexResult<Datum> {
123-
let [lhs]: [Datum; _] = args
124-
.datums
125-
.try_into()
126-
.map_err(|_| vortex_error::vortex_err!("Wrong arg count for DynamicComparison"))?;
127-
128123
if let Some(scalar) = data.rhs.scalar() {
129-
// Convert the vortex_scalar::Scalar to vortex_vector::Scalar
124+
let [lhs]: [Datum; _] = args
125+
.datums
126+
.try_into()
127+
.map_err(|_| vortex_error::vortex_err!("Wrong arg count for DynamicComparison"))?;
130128
let rhs_vector_scalar = scalar.to_vector_scalar();
131129
let rhs = Datum::Scalar(rhs_vector_scalar);
132130

133-
// Convert compute::Operator to expr::Operator
134-
let expr_op: ExprOperator = data.operator.into();
135-
136-
// Use Binary to execute the comparison
137-
return Binary.bind(expr_op).execute(ExecutionArgs {
131+
return Binary.bind(data.operator.into()).execute(ExecutionArgs {
138132
datums: vec![lhs, rhs],
139133
dtypes: args.dtypes,
140134
row_count: args.row_count,
141135
return_dtype: args.return_dtype,
142136
});
143137
}
144138

145-
// Otherwise, return the default value
146139
Ok(Datum::Scalar(VectorScalar::Bool(BoolScalar::new(Some(
147140
data.default,
148141
)))))

0 commit comments

Comments
 (0)