This is an automated email from the ASF dual-hosted git repository. starocean999 pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 0444e6c6e1d branch-3.0: [fix](nereids) fix compare with long min for simplify comparison rule (#44920) 0444e6c6e1d is described below commit 0444e6c6e1d050512980202199ae0bebd0585767 Author: yujun <yu...@selectdb.com> AuthorDate: Tue Dec 17 14:53:20 2024 +0800 branch-3.0: [fix](nereids) fix compare with long min for simplify comparison rule (#44920) pick the fix compare bug code from #44732. but #44732 not pick into 3.0 --- .../rules/expression/rules/SimplifyComparisonPredicate.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java index cb617958652..55cd74c0839 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java @@ -281,7 +281,8 @@ public class SimplifyComparisonPredicate extends AbstractExpressionRewriteRule i private static Expression processIntegerDecimalLiteralComparison( ComparisonPredicate comparisonPredicate, Expression left, BigDecimal literal) { // we only process isIntegerLikeType, which are tinyint, smallint, int, bigint - if (literal.compareTo(new BigDecimal(Long.MAX_VALUE)) <= 0) { + if (literal.compareTo(new BigDecimal(Long.MIN_VALUE)) >= 0 + && literal.compareTo(new BigDecimal(Long.MAX_VALUE)) <= 0) { literal = literal.stripTrailingZeros(); if (literal.scale() > 0) { if (comparisonPredicate instanceof EqualTo) { @@ -321,9 +322,10 @@ public class SimplifyComparisonPredicate extends AbstractExpressionRewriteRule i } private static IntegerLikeLiteral convertDecimalToIntegerLikeLiteral(BigDecimal decimal) { - Preconditions.checkArgument( - decimal.scale() <= 0 && decimal.compareTo(new BigDecimal(Long.MAX_VALUE)) <= 0, - "decimal literal must have 0 scale and smaller than Long.MAX_VALUE"); + Preconditions.checkArgument(decimal.scale() <= 0 + && decimal.compareTo(new BigDecimal(Long.MIN_VALUE)) >= 0 + && decimal.compareTo(new BigDecimal(Long.MAX_VALUE)) <= 0, + "decimal literal must have 0 scale and in range [Long.MIN_VALUE, Long.MAX_VALUE]"); long val = decimal.longValue(); if (val >= Byte.MIN_VALUE && val <= Byte.MAX_VALUE) { return new TinyIntLiteral((byte) val); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org