Uh oh!
There was an error while loading. Please reload this page.
[Feat](nereids)Support date_trunc function in partition prune - #38025
Conversation
doris-robot
commented
Jul 17, 2024
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
feiniaofeiafei
commented
Jul 17, 2024
run buildall |
doris-robot
commented
Jul 17, 2024
TPC-H: Total hot run time: 39773 ms |
doris-robot
commented
Jul 17, 2024
TPC-DS: Total hot run time: 174509 ms |
doris-robot
commented
Jul 17, 2024
ClickBench: Total hot run time: 30.69 s |
cd0a714 to
8644094Comparefeiniaofeiafei
commented
Jul 25, 2024
run buildall |
doris-robot
commented
Jul 25, 2024
TPC-H: Total hot run time: 40013 ms |
doris-robot
commented
Jul 25, 2024
TPC-DS: Total hot run time: 172812 ms |
doris-robot
commented
Jul 25, 2024
ClickBench: Total hot run time: 30.43 s |
feiniaofeiafei
commented
Jul 26, 2024
run buildall |
doris-robot
commented
Jul 26, 2024
TPC-H: Total hot run time: 39580 ms |
doris-robot
commented
Jul 26, 2024
TPC-DS: Total hot run time: 173096 ms |
doris-robot
commented
Jul 26, 2024
ClickBench: Total hot run time: 31.97 s |
b5ff552 to
8a377afComparefeiniaofeiafei
commented
Jul 26, 2024
run buildall |
doris-robot
commented
Jul 26, 2024
TPC-H: Total hot run time: 39121 ms |
doris-robot
commented
Jul 26, 2024
TPC-DS: Total hot run time: 172563 ms |
doris-robot
commented
Jul 26, 2024
ClickBench: Total hot run time: 30.67 s |
| @Override | ||
| public Monotonicity getMonotonicity() { | ||
| return new Monotonicity(true, true); |
There was a problem hiding this comment.
maybe, u should use some static variables generated in Monotonicity class. refer to org.apache.doris.nereids.properties.PhysicalProperties
| public Expression withConstantArgs(Literal literal) { | ||
| return this; | ||
| } | ||
| public int getMonotonicFunctionChildIndex() { | ||
| return -1; | ||
| } | ||
| public Monotonicity getMonotonicity() { | ||
| return new Monotonicity(false, true); | ||
| } |
There was a problem hiding this comment.
add comment to these interfaces
| } | ||
| public Expression withConstantArgs(Literal literal) { | ||
| return this; |
There was a problem hiding this comment.
return this is not a good idea. i think we should throw exceptions if on function not support Monotonicity
| public class Monotonicity { | ||
| public boolean isMonotonic; | ||
| public boolean isPositive; | ||
| public Monotonicity(boolean isMonotonic, boolean isPositive) { | ||
| this.isMonotonic = isMonotonic; | ||
| this.isPositive = isPositive; | ||
| } | ||
| } |
There was a problem hiding this comment.
move out from function, it should be expression trait?
| 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); | ||
| } |
There was a problem hiding this comment.
if we add a new trait class Monotonic for expression, could we here use visit Monotoic to do same things for all monotonic functions? then we only need add trait on different function
There was a problem hiding this comment.
we should use trait interface
publicinterfaceMonotonicextendsExpressionTrait {
booleanisPositive(); }
publicclassDateTruncimplementMonotonic {
@OverridepublicisPositive() {
returntrue;
}
}| } | ||
| public boolean isCompletelyInfinite() { | ||
| return !span().hasLowerBound() && !span().hasUpperBound(); |
There was a problem hiding this comment.
I think this is not completeInfinite
newColumnRange(
ColumnBound.lessThen(Literal.of(0)))
.union(ColumnRange.greaterThan(Literal.of(10))
);| assert slotResult != null; | ||
| assert slotResult.columnRanges.containsKey(slot); |
There was a problem hiding this comment.
assert only throw exception in test environment
| 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); | ||
| } |
There was a problem hiding this comment.
we should use trait interface
publicinterfaceMonotonicextendsExpressionTrait {
booleanisPositive(); }
publicclassDateTruncimplementMonotonic {
@OverridepublicisPositive() {
returntrue;
}
}8a377af to
0dae430Comparefeiniaofeiafei
commented
Jul 30, 2024
run buildall |
doris-robot
commented
Jul 30, 2024
TPC-H: Total hot run time: 41509 ms |
doris-robot
commented
Jul 30, 2024
TPC-DS: Total hot run time: 170487 ms |
doris-robot
commented
Jul 30, 2024
ClickBench: Total hot run time: 30.52 s |
feiniaofeiafei
commented
Jul 30, 2024
run cloud_p0 |
1 similar comment
feiniaofeiafei
commented
Jul 30, 2024
run cloud_p0 |
feiniaofeiafei
commented
Jul 31, 2024
run buildall |
doris-robot
commented
Jul 31, 2024
TPC-H: Total hot run time: 41946 ms |
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
let range partition pruner support date_trunc(dt, 'day') > 10.
For example, partition column is dt, there is a partition
('2020-01-01 10:00:00', '2020-02-05 10:00:00'),
and a predicate
date_trunc(dt, 'day')<'2019-01-01 ',
this partition can be pruned.…e#38025) let range partition pruner support date_trunc(dt, 'day') > 10. For example, partition column is dt, there is a partition ('2020-01-01 10:00:00', '2020-02-05 10:00:00'), and a predicate date_trunc(dt, 'day')<'2019-01-01 ', this partition can be pruned.
…8897) introduced by #38025 Or expression evaluate wrongly in #38025. For example, partition column is a, b, predicate is a=a or b>1 , partition column range is min<a<5, b is infinite. The evaluate result of or expression should be b is infinite(because when a is not null, a=a is true, there is no restrict for b, e.g. a=1, b=0 satisfy a=a or b>1). #38025 pr has wrongly evaluate result b >1
…8897) introduced by #38025 Or expression evaluate wrongly in #38025. For example, partition column is a, b, predicate is a=a or b>1 , partition column range is min<a<5, b is infinite. The evaluate result of or expression should be b is infinite(because when a is not null, a=a is true, there is no restrict for b, e.g. a=1, b=0 satisfy a=a or b>1). #38025 pr has wrongly evaluate result b >1
…ache#38897) introduced by apache#38025 Or expression evaluate wrongly in apache#38025. For example, partition column is a, b, predicate is a=a or b>1 , partition column range is min<a<5, b is infinite. The evaluate result of or expression should be b is infinite(because when a is not null, a=a is true, there is no restrict for b, e.g. a=1, b=0 satisfy a=a or b>1). apache#38025 pr has wrongly evaluate result b >1
…e#38025) let range partition pruner support date_trunc(dt, 'day') > 10. For example, partition column is dt, there is a partition ('2020-01-01 10:00:00', '2020-02-05 10:00:00'), and a predicate date_trunc(dt, 'day')<'2019-01-01 ', this partition can be pruned.
…e#38025) let range partition pruner support date_trunc(dt, 'day') > 10. For example, partition column is dt, there is a partition ('2020-01-01 10:00:00', '2020-02-05 10:00:00'), and a predicate date_trunc(dt, 'day')<'2019-01-01 ', this partition can be pruned.
…ache#38897) introduced by apache#38025 Or expression evaluate wrongly in apache#38025. For example, partition column is a, b, predicate is a=a or b>1 , partition column range is min<a<5, b is infinite. The evaluate result of or expression should be b is infinite(because when a is not null, a=a is true, there is no restrict for b, e.g. a=1, b=0 satisfy a=a or b>1). apache#38025 pr has wrongly evaluate result b >1
The nereids range partition pruner does not support date_trunc(dt, 'day')>10. This pr supports to compute date_trunc(dt, 'day')>10. For example, there is a partition ('2020-01-01 10:00:00', '2020-02-05 10:00:00') ,partition column is dt, and a predicate date_trunc(dt, 'day')<'2019-01-01 ', this partition can be pruned.