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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/StringLikeLiteral.java:
##########
@@ -142,6 +142,9 @@ protected Expression uncheckedCastTo(DataType targetType) 
throws AnalysisExcepti
                 timeStampTzType = TimeStampTzType.forTypeFromString(value);
             }
             if (DateTimeChecker.hasTimeZone(value)) {
+                if (strictCast && !dateStrictPattern.matcher(value).matches()) 
{
+                    throw new CastException(String.format("[%s] can't cast to 
%s.", value, targetType));

Review Comment:
   [P2] Enforce BE timezone offset bounds during FE folding
   
   This shape check matches offsets that the strict BE parser rejects, such as 
`...-14:30`, `...-15:00`, or `...+14:30`. Java's `ZoneOffset` accepts them and 
the explicit-zone branch constructs a `TimestampTzLiteral`, so strict constant 
folding can succeed while the same cast with runtime folding disabled fails in 
BE (which requires hour <=14 and minute 00 at hour 14, and limits negative 
offsets to 12 hours). Validate the sign-specific range with the same 
parser/rules and add folded/runtime boundary tests.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/StringLikeLiteral.java:
##########
@@ -142,6 +142,9 @@ protected Expression uncheckedCastTo(DataType targetType) 
throws AnalysisExcepti
                 timeStampTzType = TimeStampTzType.forTypeFromString(value);
             }
             if (DateTimeChecker.hasTimeZone(value)) {
+                if (strictCast && !dateStrictPattern.matcher(value).matches()) 
{

Review Comment:
   [P1] Preserve BE-valid colon-delimited TIMESTAMPTZ casts
   
   For `CAST('2023-07-16:19:20:30 +08:00' AS TIMESTAMPTZ)` with strict cast 
enabled, `DateTimeChecker` accepts ':' as punctuation and sees the later space 
as the timezone boundary, so this new check rejects the value because 
`dateStrictPattern` only allows `[T ]`. The BE strict parser's 
`consume_one_delimiter()` includes ':', and its pre-zone whitespace skip 
accepts the same value; before this guard, `DateLiteral.normalize()` converted 
the punctuation and FE folded it. Align the FE and BE delimiter grammar (or 
reject it consistently) and add a folded/runtime regression test.



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