924060929 commented on code in PR #38025: URL: https://github.com/apache/doris/pull/38025#discussion_r1696209931
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/ColumnRange.java: ########## @@ -69,6 +69,10 @@ public boolean isEmptyRange() { return rangeSet.isEmpty(); } + public boolean isCompletelyInfinite() { + return !span().hasLowerBound() && !span().hasUpperBound(); Review Comment: I think this is not completeInfinite ```java new ColumnRange( ColumnBound.lessThen(Literal.of(0))) .union(ColumnRange.greaterThan(Literal.of(10)) ); ``` ########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java: ########## @@ -616,6 +630,19 @@ private List<Literal> toMultiNereidsLiterals(PartitionKey partitionKey) { return literals; } + @Override + public EvaluateRangeResult visitDateTrunc(DateTrunc dateTrunc, EvaluateRangeInput context) { + EvaluateRangeResult result = super.visitDateTrunc(dateTrunc, context); + if (!(result.result instanceof DateTrunc)) { + return result; + } + Expression dateTruncChild = dateTrunc.child(0); + if (partitionSlotContainsNull.containsKey(dateTruncChild)) { + partitionSlotContainsNull.put(dateTrunc, true); + } + return computeMonotonicFunctionRange(result); + } Review Comment: we should use trait interface ```java public interface Monotonic extends ExpressionTrait { boolean isPositive(); } public class DateTrunc implement Monotonic { @Override public isPositive() { return true; } } ``` ########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java: ########## @@ -194,22 +197,14 @@ public EvaluateRangeResult visit(Expression expr, EvaluateRangeInput context) { return result; } - @Override - public EvaluateRangeResult visitNullLiteral(NullLiteral nullLiteral, EvaluateRangeInput context) { - Map<Slot, ColumnRange> emptyRanges = Maps.newHashMap(); - for (Slot key : context.defaultColumnRanges.keySet()) { - emptyRanges.put(key, new ColumnRange()); - } - return new EvaluateRangeResult(nullLiteral, emptyRanges, ImmutableList.of()); - } - @Override public EvaluateRangeResult visitSlot(Slot slot, EvaluateRangeInput context) { // try to replace partition slot to literal PartitionSlotInput slotResult = context.slotToInput.get(slot); - return slotResult == null - ? new EvaluateRangeResult(slot, context.defaultColumnRanges, ImmutableList.of()) - : new EvaluateRangeResult(slotResult.result, slotResult.columnRanges, ImmutableList.of()); + assert slotResult != null; + assert slotResult.columnRanges.containsKey(slot); Review Comment: assert only throw exception in test environment -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org