jacktengg commented on code in PR #66761:
URL: https://github.com/apache/doris/pull/66761#discussion_r3860681931
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/PredicateRewriteForPartitionPrune.java:
##########
@@ -45,13 +52,30 @@ public static Expression rewrite(Expression expression,
return expression.accept(rewriter, cascadesContext);
}
- /* F: a DateTime or DateTimeV2 column
+ /* F: a DateTime, DateTimeV2, or TimeStampNs column
* Date(F) in (2020-01-02, 2020-01-01) =>
* (2020-01-01 24:00:00 >= F >= 2020-01-01 00:00:00)
* or (2020-01-02 24:00:00 >= F >= 2020-01-02 00:00:00)
*/
@Override
public Expression visitInPredicate(InPredicate in, CascadesContext
context) {
+ if (isDateTimeV2ToTimeStampNsCast(in.getCompareExpr())) {
Review Comment:
The rewrite can indeed avoid evaluating an overflowing cast in a pruned
partition, but this is established Doris partition-pruning behavior.
test_add_sub_diff_ceil_floor.groovy explicitly verifies that an overflowing
date_ceil in a partition excluded by a necessary bare-column condition is not
observable. Strict cast requires a failure when the cast is evaluated; it does
not require scanning a partition that cannot contribute a successful match. For
representable values the rewritten equality/IN predicate is exact, and an
unaligned TIMESTAMP_NS option cannot match any successfully cast DATETIMEV2
value. Preserving such errors would therefore be a broader change to Doris
pruning semantics rather than a TIMESTAMP_NS-specific fix.
--
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]