|
10 | 10 | //! the equivalent Arrow compute function. |
11 | 11 |
|
12 | 12 | use vortex_error::VortexResult; |
13 | | -use vortex_session::VortexSession; |
14 | 13 |
|
15 | 14 | use crate::Array; |
16 | 15 | use crate::ArrayRef; |
17 | | -use crate::ExecutionCtx; |
18 | 16 | use crate::IntoArray; |
19 | 17 | use crate::arrays::ConstantArray; |
20 | 18 | use crate::arrays::ScalarFnArrayExt; |
@@ -63,8 +61,8 @@ pub trait ExprBuiltins: Sized { |
63 | 61 | /// Check if a list contains a value. |
64 | 62 | fn list_contains(&self, value: Expression) -> VortexResult<Expression>; |
65 | 63 |
|
66 | | - /// Conditional selection: `result[i] = if mask[i] then self[i] else if_false[i]`. |
67 | | - fn zip(&self, if_false: Expression, mask: Expression) -> VortexResult<Expression>; |
| 64 | + /// Conditional selection: `result[i] = if mask[i] then if_true[i] else if_false[i]`. |
| 65 | + fn zip(&self, if_true: Expression, if_false: Expression) -> VortexResult<Expression>; |
68 | 66 |
|
69 | 67 | /// Apply a binary operator to this expression and another. |
70 | 68 | fn binary(&self, rhs: Expression, op: Operator) -> VortexResult<Expression>; |
@@ -99,8 +97,8 @@ impl ExprBuiltins for Expression { |
99 | 97 | ListContains.try_new_expr(EmptyOptions, [self.clone(), value]) |
100 | 98 | } |
101 | 99 |
|
102 | | - fn zip(&self, if_false: Expression, mask: Expression) -> VortexResult<Expression> { |
103 | | - Zip.try_new_expr(EmptyOptions, [self.clone(), if_false, mask]) |
| 100 | + fn zip(&self, if_true: Expression, if_false: Expression) -> VortexResult<Expression> { |
| 101 | + Zip.try_new_expr(EmptyOptions, [if_true, if_false, self.clone()]) |
104 | 102 | } |
105 | 103 |
|
106 | 104 | fn binary(&self, rhs: Expression, op: Operator) -> VortexResult<Expression> { |
@@ -129,8 +127,8 @@ pub trait ArrayBuiltins: Sized { |
129 | 127 | /// Boolean negation. |
130 | 128 | fn not(&self) -> VortexResult<ArrayRef>; |
131 | 129 |
|
132 | | - /// Conditional selection: `result[i] = if mask[i] then self[i] else if_false[i]`. |
133 | | - fn zip(&self, if_false: ArrayRef, mask: ArrayRef) -> VortexResult<ArrayRef>; |
| 130 | + /// Conditional selection: `result[i] = if mask[i] then if_true[i] else if_false[i]`. |
| 131 | + fn zip(&self, if_true: ArrayRef, if_false: ArrayRef) -> VortexResult<ArrayRef>; |
134 | 132 |
|
135 | 133 | /// Check if a list contains a value. |
136 | 134 | fn list_contains(&self, value: ArrayRef) -> VortexResult<ArrayRef>; |
@@ -195,11 +193,8 @@ impl ArrayBuiltins for ArrayRef { |
195 | 193 | .optimize() |
196 | 194 | } |
197 | 195 |
|
198 | | - fn zip(&self, if_false: ArrayRef, mask: ArrayRef) -> VortexResult<ArrayRef> { |
199 | | - let scalar_fn = |
200 | | - Zip.try_new_array(self.len(), EmptyOptions, [self.clone(), if_false, mask])?; |
201 | | - let mut ctx = ExecutionCtx::new(VortexSession::empty()); |
202 | | - scalar_fn.execute::<ArrayRef>(&mut ctx) |
| 196 | + fn zip(&self, if_true: ArrayRef, if_false: ArrayRef) -> VortexResult<ArrayRef> { |
| 197 | + Zip.try_new_array(self.len(), EmptyOptions, [if_true, if_false, self.clone()]) |
203 | 198 | } |
204 | 199 |
|
205 | 200 | fn list_contains(&self, value: ArrayRef) -> VortexResult<ArrayRef> { |
|
0 commit comments