Skip to content

Commit 9af4e14

Browse files
authored
Chore: Add all logical bool implementations + refactor (#5669)
This PR consolidates and finalizes a lot of the boolean and Kleene logic, and also deduplicates a bunch of code. Instead of having each of the operands in separate modules, I grouped them into logical operands, kleene operands, and `not` by itself since it is the only unary operator. The convenience trait impls all have the same 3 impls: for `&BoolScalar`, `&BoolVector`, `&BoolDatum`. ```rust impl LogicalAndKleene for &BoolScalar { ... } impl LogicalAndKleene for &BoolVector { ... } impl LogicalAndKleene for &BoolDatum { ... } ``` Also adds more tests. --------- Signed-off-by: Connor Tsui <[email protected]>
1 parent ede0ad6 commit 9af4e14

File tree

10 files changed

+1082
-678
lines changed

10 files changed

+1082
-678
lines changed

vortex-array/src/scalar_fns/binary/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,16 @@ impl VTable for BinaryFn {
101101
Operator::Lte => Ok(Compare::<LessThanOrEqual>::compare(lhs, rhs).into()),
102102
Operator::Gt => Ok(Compare::<GreaterThan>::compare(lhs, rhs).into()),
103103
Operator::Gte => Ok(Compare::<GreaterThanOrEqual>::compare(lhs, rhs).into()),
104-
Operator::And => Ok(<BoolDatum as LogicalOp<KleeneAnd>>::op(
105-
lhs.into_bool(),
106-
rhs.into_bool(),
104+
Operator::And => Ok(<&BoolDatum as LogicalOp<KleeneAnd>>::op(
105+
&lhs.into_bool(),
106+
&rhs.into_bool(),
107+
)
108+
.into()),
109+
Operator::Or => Ok(<&BoolDatum as LogicalOp<KleeneOr>>::op(
110+
&lhs.into_bool(),
111+
&rhs.into_bool(),
107112
)
108113
.into()),
109-
Operator::Or => {
110-
Ok(<BoolDatum as LogicalOp<KleeneOr>>::op(lhs.into_bool(), rhs.into_bool()).into())
111-
}
112114
Operator::Add | Operator::Sub | Operator::Mul | Operator::Div => {
113115
execute_arithmetic_primitive(lhs.into_primitive(), rhs.into_primitive(), *op)
114116
}

vortex-compute/src/logical/and.rs

Lines changed: 0 additions & 57 deletions
This file was deleted.

vortex-compute/src/logical/and_kleene.rs

Lines changed: 0 additions & 218 deletions
This file was deleted.

vortex-compute/src/logical/and_not.rs

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)