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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/StringLikeLiteral.java:
##########
@@ -148,20 +145,12 @@ protected Expression uncheckedCastTo(DataType targetType) 
throws AnalysisExcepti
             return new DateTimeLiteral((DateTimeType) targetType, 
datetime.year, datetime.month, datetime.day,
                     datetime.hour, datetime.minute, datetime.second, 
datetime.microSecond);
         } else if (targetType.isTimeStampTzType()) {
-            // Explicit offsets must not round-trip through session local 
time; that loses the selected
-            // branch in DST fold hours. Wildcard targets still need a 
concrete scale before parsing.
+            // Wildcard targets still need a concrete scale before parsing.
             TimeStampTzType timeStampTzType = (TimeStampTzType) targetType;
             if (timeStampTzType.getScale() < 0) {
                 timeStampTzType = TimeStampTzType.forTypeFromString(value);
             }
-            if (DateTimeChecker.hasTimeZone(value)) {
-                return new TimestampTzLiteral(timeStampTzType, value);
-            }
-            DateTimeV2Literal expression = castToDateTime(DateTimeV2Type.MAX, 
strictCast, true);
-            expression = (DateTimeV2Literal) 
(DateTimeExtractAndTransform.convertTz(expression,
-                    new 
StringLiteral(ConnectContext.get().getSessionVariable().timeZone), new 
StringLiteral("UTC")));
-            return new TimestampTzLiteral(timeStampTzType, expression.year, 
expression.month,
-                    expression.day, expression.hour, expression.minute, 
expression.second, expression.microSecond);

Review Comment:
   This no-offset TIMESTAMPTZ cast path no longer honors `enable_strict_cast`. 
Before this change, strings without an explicit zone went through 
`castToDateTime(DateTimeV2Type.MAX, strictCast, true)`, so strict mode used 
`dateStrictPattern` and rejected unstrict datetime spellings. Now 
`fromSessionTimeZone()` constructs `new DateTimeV2Literal(s)` directly, 
bypassing the `strictCast` flag while the DATETIME/DATETIMEV2 branches above 
still use `castToDateTime(..., strictCast, ...)`. As a result `CAST(... AS 
TIMESTAMPTZ)` can accept no-offset formats under `enable_strict_cast=true` that 
equivalent DATETIMEV2 casts and the previous TIMESTAMPTZ implementation reject. 
Please preserve the old `castToDateTime` strict parsing for the 
no-explicit-timezone branch, then convert that parsed value from the session 
timezone to UTC.



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