BiteTheDDDDt commented on code in PR #65903:
URL: https://github.com/apache/doris/pull/65903#discussion_r3635495871


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Cast.java:
##########
@@ -273,10 +281,45 @@ public Expression withConstantArgs(Expression literal) {
 
     @Override
     public boolean isMonotonic(Literal lower, Literal upper) {
-        // Both upward and downward casting of date types satisfy monotonicity.
-        if (child().getDataType() instanceof DateLikeType && targetType 
instanceof DateLikeType) {
+        DataType childType = child().getDataType();
+        if (!(childType instanceof DateLikeType && targetType instanceof 
DateLikeType)) {
+            return false;
+        }
+
+        if (childType instanceof TimeStampTzType && targetType instanceof 
DateTimeV2Type) {
+            return isTimeStampTzToDateTimeV2Monotonic(
+                    (TimeStampTzType) childType, (DateTimeV2Type) targetType, 
lower, upper);
+        }
+        return true;
+    }
+
+    private boolean isTimeStampTzToDateTimeV2Monotonic(
+            TimeStampTzType sourceType, DateTimeV2Type destinationType, 
Literal lower, Literal upper) {
+        ZoneId timeZone;
+        try {
+            timeZone = DateUtils.getTimeZone();

Review Comment:
   Addressed in 7ec5aeb5bf2. Cast monotonicity now uses 
`TimeUtils.getDorisZoneId()`, which applies Doris's shared alias map (`CST` -> 
`Asia/Shanghai`) instead of the bare Java `ZoneId` parser. The change is local 
to this classification path and does not broaden the existing FE/BE tzdb 
policy. Added `testDorisTimeZoneAliasIsMonotonic`; the targeted FE suite passes 
37/37 tests.
   



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