github-actions[bot] commented on code in PR #64127:
URL: https://github.com/apache/doris/pull/64127#discussion_r3359906008


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java:
##########
@@ -1177,29 +1207,43 @@ public static Expression hoursDiff(DateV2Literal t1, 
DateV2Literal t2) {

Review Comment:
   This changes `days_diff` folding for `DateTimeV2` from whole-day duration 
semantics to calendar-day semantics, which no longer matches BE runtime. BE 
evaluates `days_diff` via `datetime_diff<DAY>` and 
`date_diff_in_days_round_to_zero_by_time`, so `days_diff('2021-01-02 00:00:00', 
'2021-01-01 23:59:59')` returns `0` at runtime because the difference is less 
than one full day. With this new `toDays(t1) - toDays(t2)` folding it returns 
`1`, so enabling constant folding changes query results. The same issue applies 
to the overloads below where either argument is `DateTimeV2Literal`; only the 
pure `DateV2` case is safe to compute from day numbers.



-- 
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]

Reply via email to