[fix](planner) binary predicate result should compare with 0 (#39474) (#39717)

pick from master #39474
This commit is contained in:
morrySnow
2024-08-21 20:47:14 +08:00
committed by GitHub
parent 2890a98b18
commit b878f7f1a6

View File

@ -816,7 +816,7 @@ public class BinaryPredicate extends Predicate implements Writable {
return compareLiteral((LiteralExpr) leftChildValue, (LiteralExpr) rightChildValue);
}
private Expr compareLiteral(LiteralExpr first, LiteralExpr second) throws AnalysisException {
private Expr compareLiteral(LiteralExpr first, LiteralExpr second) {
final boolean isFirstNull = (first instanceof NullLiteral);
final boolean isSecondNull = (second instanceof NullLiteral);
if (op == Operator.EQ_FOR_NULL) {
@ -837,13 +837,13 @@ public class BinaryPredicate extends Predicate implements Writable {
case EQ_FOR_NULL:
return new BoolLiteral(compareResult == 0);
case GE:
return new BoolLiteral(compareResult == 1 || compareResult == 0);
return new BoolLiteral(compareResult >= 0);
case GT:
return new BoolLiteral(compareResult == 1);
return new BoolLiteral(compareResult > 0);
case LE:
return new BoolLiteral(compareResult == -1 || compareResult == 0);
return new BoolLiteral(compareResult <= 0);
case LT:
return new BoolLiteral(compareResult == -1);
return new BoolLiteral(compareResult < 0);
case NE:
return new BoolLiteral(compareResult != 0);
default: