[feature](nereids) const folding for in-predicate with null literal (#15880)
select 1 in (2 , null) => null select 1 in (1 , null) => true select 1 not in (2 , null) => null select 1 not in (1 , null) => false
This commit is contained in:
@ -328,11 +328,18 @@ public class FoldConstantRuleOnFE extends AbstractExpressionRewriteRule {
|
||||
return inPredicate;
|
||||
}
|
||||
|
||||
boolean hasNull = false;
|
||||
for (Expression item : inPredicate.getOptions()) {
|
||||
if (item.isNullLiteral()) {
|
||||
hasNull = true;
|
||||
}
|
||||
if (valueIsLiteral && value.equals(item)) {
|
||||
return BooleanLiteral.TRUE;
|
||||
}
|
||||
}
|
||||
if (hasNull) {
|
||||
return NullLiteral.INSTANCE;
|
||||
}
|
||||
return BooleanLiteral.FALSE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user