liukun4515 commented on code in PR #2764:
URL: https://github.com/apache/arrow-datafusion/pull/2764#discussion_r905654902
##########
datafusion/physical-expr/src/expressions/in_list.rs:
##########
@@ -300,6 +306,130 @@ fn cast_static_filter_to_set(list: &[Arc<dyn
PhysicalExpr>]) -> HashSet<ScalarVa
}))
}
+fn make_list_contains_decimal(
+ array: &DecimalArray,
+ list: Vec<ColumnarValue>,
+ negated: bool,
+) -> BooleanArray {
+ let contains_null = list
+ .iter()
+ .any(|v| matches!(v, ColumnarValue::Scalar(s) if s.is_null()));
+ let values = list
+ .iter()
+ .flat_map(|v| match v {
+ ColumnarValue::Scalar(s) => match s {
+ Decimal128(v128op, _, _) => v128op.map(|v128| v128),
+ _ => {
+ unreachable!(
+ "InList can't reach other data type for decimal data
type."
+ )
+ }
+ },
+ ColumnarValue::Array(_) => {
+ unimplemented!("InList does not yet support nested columns.")
+ }
+ })
+ .collect::<Vec<_>>();
+
+ if !negated {
+ // In
+ array
+ .iter()
+ .map(|v| match v {
+ None => None,
+ Some(v128) => {
+ if values.contains(&v128) {
+ Some(true)
+ } else {
+ Some(false)
+ }
+ }
+ })
+ .collect::<BooleanArray>()
+ } else {
+ // Not in
+ if contains_null {
+ // if the expr is NOT IN and the list contains NULL value
+ // All the result must be NONE
+ vec![None; array.len()]
Review Comment:
I will change the code to
```
BooleanArray::from(xxx)
```
--
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]