diff --git a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs index d315bdf4620a9..e223ac86ff8c4 100644 --- a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs +++ b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs @@ -196,14 +196,16 @@ impl ExprSimplifier { } = expr .rewrite(&mut const_evaluator)? .transform_data(|expr| expr.rewrite(&mut simplifier))? - .transform_data(|expr| expr.rewrite(&mut guarantee_rewriter))? - .transform_data(|expr| expr.rewrite(&mut shorten_in_list_simplifier))?; + .transform_data(|expr| expr.rewrite(&mut guarantee_rewriter))?; expr = data; num_iterations += 1; if !transformed || num_iterations >= self.max_simplifier_iterations { - return Ok((expr, num_iterations)); + break; } } + // shorten inlist should be started after other inlist rules are applied + expr = expr.rewrite(&mut shorten_in_list_simplifier).data()?; + return Ok((expr, num_iterations)); } /// Apply type coercion to an [`Expr`] so that it can be