Skip to content

Commit

Permalink
fallback to the previous if the in_list fails
Browse files Browse the repository at this point in the history
  • Loading branch information
advancedxy committed Mar 10, 2024
1 parent 20c67df commit 5868b25
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions core/src/execution/datafusion/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ use datafusion::{
physical_expr::{
execution_props::ExecutionProps,
expressions::{
in_list, BinaryExpr, CaseExpr, CastExpr, Column, Count, FirstValue, IsNotNullExpr,
IsNullExpr, LastValue, Literal as DataFusionLiteral, Max, Min, NegativeExpr, NotExpr,
Sum, UnKnownColumn,
in_list, BinaryExpr, CaseExpr, CastExpr, Column, Count, FirstValue, InListExpr,
IsNotNullExpr, IsNullExpr, LastValue, Literal as DataFusionLiteral, Max, Min,
NegativeExpr, NotExpr, Sum, UnKnownColumn,
},
functions::create_physical_expr,
AggregateExpr, PhysicalExpr, PhysicalSortExpr, ScalarFunctionExpr,
Expand Down Expand Up @@ -493,7 +493,16 @@ impl PhysicalPlanner {
.iter()
.map(|x| self.create_expr(x, input_schema.clone()).unwrap())
.collect::<Vec<_>>();
in_list(value, list, &expr.negated, input_schema.as_ref()).map_err(|e| e.into())
// in_list doesn't handle value being dictionary type correctly, so we need to fall
// back to InListExpr if in_list fails.
// TODO: remove the fallback when https://github.com/apache/arrow-datafusion/issues/9530 is fixed
in_list(
value.clone(),
list.clone(),
&expr.negated,
input_schema.as_ref(),
)
.or_else(|_| Ok(Arc::new(InListExpr::new(value, list, expr.negated, None))))
}
ExprStruct::If(expr) => {
let if_expr =
Expand Down

0 comments on commit 5868b25

Please sign in to comment.