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
8 changes: 5 additions & 3 deletions datafusion/physical-expr/src/expressions/in_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,16 @@ impl ArrayHashSet {
_ => {}
}

let has_nulls = in_array.null_count() != 0;
let needle_nulls = v.logical_nulls();
let needle_nulls = needle_nulls.as_ref();
let haystack_has_nulls = in_array.null_count() != 0;

with_hashes([v], &self.state, |hashes| {
let cmp = make_comparator(v, in_array, SortOptions::default())?;
Ok((0..v.len())
.map(|i| {
// SQL three-valued logic: null IN (...) is always null
if v.is_null(i) {
if needle_nulls.is_some_and(|nulls| nulls.is_null(i)) {
return None;
}

Expand All @@ -118,7 +120,7 @@ impl ArrayHashSet {

match contains {
true => Some(!negated),
false if has_nulls => None,
false if haystack_has_nulls => None,
false => Some(negated),
}
})
Expand Down
Loading