github-actions[bot] commented on code in PR #69073:
URL: https://github.com/apache/doris/pull/69073#discussion_r4270768938
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java:
##########
@@ -133,6 +140,16 @@ public class ExpressionUtils {
// folding the conjunct). We restrict MAX_MARK_SLOT_COUNT to 4 to bound
this cost.
private static final int MAX_MARK_SLOT_COUNT = 4;
+ /**
+ * Preserve date arithmetic's evaluation domain above a lower condition or
limit.
+ * A CTE consumer may also push a predicate into a producer whose
conditions are outside this input tree.
+ */
+ public static boolean requiresDateArithmeticProtection(Expression
expression, Plan input) {
+ return expression.containsType(DateAddSubMonotonic.class,
DateCeilFloorMonotonic.class)
Review Comment:
[P2] Preserve partition pruning for safe zero-offset date aliases
Adding an unrelated inner WHERE to the new pruning case now loses pruning:
```text
Filter(d = DATE '2020-01-02')
Project(DAYS_ADD(dt, 0) AS d, id)
Filter(id > 0)
Scan(t partitioned by dt)
```
The marker plus lower Filter makes this helper return true, so the date
equality stays above Project. PruneOlapScanPartition sees only id > 0 beside
the scan and selects all three daily partitions instead of p2; the same shape
can scan every partition of a large table. Previously alias substitution
exposed DAYS_ADD(dt,0)=literal, which SimplifyArithmeticComparisonRule reduced
to dt=DAYS_SUB(literal,0) and then dt=literal. Zero-day addition is safe for
every DATE in the test table's 2020 ranges, so this extra restriction does not
protect against overflow. Keep provably safe aliases eligible for pushdown, or
derive an equivalent safe base-column predicate for pruning, and extend the
regression case with this inner WHERE.
--
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]