[fix](nereids)SimplifyRange rule may mess up and/or predicate (#26304)

This commit is contained in:
starocean999
2023-11-03 20:38:07 +08:00
committed by GitHub
parent 646348ccc4
commit 11059ca4ed
2 changed files with 2 additions and 1 deletions

View File

@ -450,7 +450,7 @@ public class SimplifyRange extends AbstractExpressionRewriteRule {
@Override
public ValueDesc intersect(ValueDesc other) {
Expression originExpr = ExpressionUtils.and(expr, other.expr);
return new UnknownValue(ImmutableList.of(this, other), originExpr, ExpressionUtils::or);
return new UnknownValue(ImmutableList.of(this, other), originExpr, ExpressionUtils::and);
}
@Override

View File

@ -104,6 +104,7 @@ public class SimplifyRangeTest {
assertRewrite("TA in (1) and TA in (1)", "TA = 1");
assertRewrite("(TA > 3 and TA < 1) and TB < 5", "FALSE");
assertRewrite("(TA > 3 and TA < 1) or TB < 5", "TB < 5");
assertRewrite("((IA = 1 AND SC ='1') OR SC = '1212') AND IA =1", "((IA = 1 AND SC ='1') OR SC = '1212') AND IA =1");
}
private void assertRewrite(String expression, String expected) {