Skip to content

Commit

Permalink
chore: Use in_list func directly (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
advancedxy authored Jun 13, 2024
1 parent 49423ed commit 558a593
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions core/src/execution/datafusion/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use datafusion::{
execution_props::ExecutionProps,
expressions::{
in_list, BinaryExpr, BitAnd, BitOr, BitXor, CaseExpr, CastExpr, Column, Count,
FirstValue, InListExpr, IsNotNullExpr, IsNullExpr, LastValue,
Literal as DataFusionLiteral, Max, Min, NotExpr, Sum,
FirstValue, IsNotNullExpr, IsNullExpr, LastValue, Literal as DataFusionLiteral, Max,
Min, NotExpr, Sum,
},
AggregateExpr, PhysicalExpr, PhysicalSortExpr, ScalarFunctionExpr,
},
Expand Down Expand Up @@ -544,18 +544,7 @@ impl PhysicalPlanner {
.map(|x| self.create_expr(x, input_schema.clone()))
.collect::<Result<Vec<_>, _>>()?;

// if schema contains any dictionary type, we should use InListExpr instead of
// in_list as it doesn't handle value being dictionary type correctly
let contains_dict_type = input_schema
.fields()
.iter()
.any(|f| matches!(f.data_type(), DataType::Dictionary(_, _)));
if contains_dict_type {
// TODO: remove the fallback when https://github.com/apache/arrow-datafusion/issues/9530 is fixed
Ok(Arc::new(InListExpr::new(value, list, expr.negated, None)))
} else {
in_list(value, list, &expr.negated, input_schema.as_ref()).map_err(|e| e.into())
}
in_list(value, list, &expr.negated, input_schema.as_ref()).map_err(|e| e.into())
}
ExprStruct::If(expr) => {
let if_expr =
Expand Down

0 comments on commit 558a593

Please sign in to comment.