Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,13 @@ public Expression rewrite(Expression expr, ExpressionRewriteContext ctx) {
} else if (expr instanceof AggregateExpression && ((AggregateExpression) expr).getFunction().isDistinct()) {
return expr;
}
return expr.accept(this, ctx);
// ATTN: we must return original expr, because OrToIn is implemented with MutableState,
// newExpr will lose these states leading to dead loop by OrToIn -> SimplifyRange -> FoldConstantByFE
Expression newExpr = expr.accept(this, ctx);
if (newExpr.equals(expr)) {
return expr;
}
return newExpr;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public List<ExpressionPatternMatcher<? extends Expression>> buildRules() {

public Expression rewriteTree(Expression expr, ExpressionRewriteContext context) {
if (expr instanceof CompoundPredicate) {
expr = SimplifyRange.rewrite((CompoundPredicate) expr);
expr = SimplifyRange.rewrite((CompoundPredicate) expr, context);
}
ExpressionBottomUpRewriter bottomUpRewriter = ExpressionRewrite.bottomUp(this);
return bottomUpRewriter.rewrite(expr, context);
Expand Down
Loading