Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions vortex-array/src/expr/exprs/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ impl VTable for Binary {
Ok(match operator {
// AND and OR are kleene logic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

Operator::And => None,
Operator::Or => None,
_ => {
// All other binary operators are null if either side is null.
Some(and(lhs, rhs))
Expand Down Expand Up @@ -523,6 +524,7 @@ mod tests {
use vortex_scalar::Scalar;

use super::*;
use crate::assert_arrays_eq;
use crate::expr::Expression;
use crate::expr::exprs::get_item::col;
use crate::expr::exprs::literal::lit;
Expand Down Expand Up @@ -673,4 +675,27 @@ mod tests {
"Different structs should not be equal"
);
}

#[test]
fn test_or_kleene_validity() {
use crate::IntoArray;
use crate::arrays::BoolArray;
use crate::arrays::StructArray;
use crate::expr::exprs::get_item::col;

let struct_arr = StructArray::from_fields(&[
("a", BoolArray::from_iter([Some(true)]).into_array()),
(
"b",
BoolArray::from_iter([Option::<bool>::None]).into_array(),
),
])
.unwrap()
.into_array();

let expr = or(col("a"), col("b"));
let result = struct_arr.apply(&expr).unwrap();

assert_arrays_eq!(result, BoolArray::from_iter([Some(true)]).into_array())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need into_array

}
}
Loading