924060929 commented on code in PR #42934:
URL: https://github.com/apache/doris/pull/42934#discussion_r1858613522
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java:
##########
@@ -820,15 +786,31 @@ private List<Map<Slot, PartitionSlotInput>>
commonComputeOnePartitionInputs() {
return onePartitionInputs;
}
- private EvaluateRangeResult
computeMonotonicFunctionRange(EvaluateRangeResult result,
- Map<Expression, ColumnRange> rangeMap) {
+ public EvaluateRangeResult visitMonotonic(Expression monotonic,
EvaluateRangeInput context) {
+ EvaluateRangeResult rangeResult = evaluateChildrenThenThis(monotonic,
context);
+ if (!rangeResult.result.getClass().equals(monotonic.getClass())) {
+ return rangeResult;
+ }
+ return computeMonotonicFunctionRange(rangeResult, context);
+ }
+
+ private EvaluateRangeResult
computeMonotonicFunctionRange(EvaluateRangeResult result, EvaluateRangeInput
context) {
Monotonic func = (Monotonic) result.result;
- if (rangeMap.containsKey(func)) {
+ if (context.rangeMap.containsKey(func)) {
return new EvaluateRangeResult((Expression) func,
ImmutableMap.of((Expression) func,
- rangeMap.get(func)), result.childrenResult);
+ context.rangeMap.get(func)), result.childrenResult);
}
int childIndex = func.getMonotonicFunctionChildIndex();
Expression funcChild = func.child(childIndex);
+ Expression forNullable;
+ if (partitionSlotContainsNull.containsKey(funcChild)) {
+ forNullable =
func.withConstantArgs(partitionSlotContainsNull.get(funcChild)
+ ? new Nullable(funcChild) : new NonNullable(funcChild));
+ } else {
+ forNullable = func.withConstantArgs(new Nullable(funcChild));
+ }
Review Comment:
```java
boolean isNullable = partitionSlotContainsNull.getOrDefault(funcChild, true);
Expression withNullable = func.withConstantArgs(
isNullable ? new Nullable(funcChild) : new NonNullable(funcChild)
);
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]