IN LIST: add UInt8 bitmap filter by geoffreyclaude · Pull Request #23011 · apache/datafusion · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
171 changes: 148 additions & 23 deletions datafusion/physical-expr/src/expressions/in_list/primitive_filter.rs
17 changes: 17 additions & 0 deletions datafusion/physical-expr/src/expressions/in_list/static_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,20 @@ pub(super) trait StaticFilter {
/// implementation unwraps the dictionary and operates on its values.
fn contains(&self, v: &dyn Array, negated: bool) -> Result<BooleanArray>;
}

/// Evaluate dictionary-encoded needles by applying a filter to dictionary
/// values and remapping the result through the keys.
macro_rules! handle_dictionary {
($self:ident, $v:ident, $negated:ident) => {
arrow::array::downcast_dictionary_array! {
$v => {
let values_contains = $self.contains($v.values().as_ref(), $negated)?;
let result = arrow::compute::take(&values_contains, $v.keys(), None)?;
return Ok(arrow::array::downcast_array(result.as_ref()))
}
_ => {}
}
};
}

pub(super) use handle_dictionary;
Loading