adriangb commented on code in PR #19050:
URL: https://github.com/apache/datafusion/pull/19050#discussion_r2586047355
##########
datafusion/physical-expr/src/expressions/in_list.rs:
##########
@@ -226,31 +226,61 @@ impl StaticFilter for Int32StaticFilter {
}
fn contains(&self, v: &dyn Array, negated: bool) -> Result<BooleanArray> {
+ // Handle dictionary arrays by recursing on the values
+ downcast_dictionary_array! {
+ v => {
+ let values_contains = self.contains(v.values().as_ref(),
negated)?;
+ let result = take(&values_contains, v.keys(), None)?;
+ return Ok(downcast_array(result.as_ref()))
+ }
+ _ => {}
+ }
Review Comment:
The lack of this was a bug
##########
datafusion/physical-expr/src/expressions/in_list.rs:
##########
@@ -226,31 +226,61 @@ impl StaticFilter for Int32StaticFilter {
}
fn contains(&self, v: &dyn Array, negated: bool) -> Result<BooleanArray> {
+ // Handle dictionary arrays by recursing on the values
+ downcast_dictionary_array! {
+ v => {
+ let values_contains = self.contains(v.values().as_ref(),
negated)?;
+ let result = take(&values_contains, v.keys(), None)?;
+ return Ok(downcast_array(result.as_ref()))
+ }
+ _ => {}
+ }
+
let v = v
.as_primitive_opt::<Int32Type>()
.ok_or_else(|| exec_datafusion_err!("Failed to downcast array"))?;
- let result = match (v.null_count() > 0, negated) {
- (true, false) => {
- // has nulls, not negated"
- BooleanArray::from_iter(
- v.iter().map(|value| Some(self.values.contains(&value?))),
Review Comment:
We were not handling nulls properly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]