Skip to content

Commit 724ddb9

Browse files
[Feat](nereids) Support date_trunc function in partition prune (apache#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.
1 parent fb2d6cd commit 724ddb9

File tree

6 files changed

+560
-119
lines changed

6 files changed

+560
-119
lines changed

fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/ColumnRange.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,12 @@ public static ColumnRange between(Literal lower, Literal upper) {
138138
public static ColumnRange range(Literal lower, BoundType lowerType, Literal upper, BoundType upperType) {
139139
return new ColumnRange(ColumnBound.range(lower, lowerType, upper, upperType));
140140
}
141+
142+
public ColumnRange withLowerBound(Literal lower) {
143+
return this.intersect(atLeast(lower));
144+
}
145+
146+
public ColumnRange withUpperBound(Literal upper) {
147+
return this.intersect(atMost(upper));
148+
}
141149
}

0 commit comments

Comments
 (0)