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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java:
##########
@@ -655,27 +653,7 @@ public static Optional<Expression> 
characterLiteralTypeCoercion(String value, Da
                     && DateTimeChecker.isValidDateTime(value)) {
                 ret = DateTimeLiteral.parseDateTimeLiteral(value, 
true).orElse(null);
             } else if (dataType.isTimeStampTzType() && 
DateTimeChecker.isValidDateTime(value)) {
-                if (DateTimeChecker.hasTimeZone(value)) {
-                    // Signature search can pass TIMESTAMPTZ(*) here. 
TimestampTzLiteral rounds by scale,
-                    // so derive a concrete scale from the literal before 
preserving its explicit offset.
-                    TimeStampTzType timeStampTzType = (TimeStampTzType) 
dataType;
-                    if (timeStampTzType.getScale() < 0) {
-                        timeStampTzType = 
TimeStampTzType.forTypeFromString(value);
-                    }
-                    ret = new TimestampTzLiteral(timeStampTzType, value);
-                } else {
-                    DateTimeV2Literal dtV2Lit = (DateTimeV2Literal) 
DateTimeLiteral
-                                    .parseDateTimeLiteral(value, 
true).orElse(null);
-                    if (dtV2Lit != null) {
-                        dtV2Lit = (DateTimeV2Literal) 
(DateTimeExtractAndTransform.convertTz(
-                                dtV2Lit,
-                                new 
StringLiteral(ConnectContext.get().getSessionVariable().timeZone),
-                                new StringLiteral("UTC")));
-                        ret = new TimestampTzLiteral(dtV2Lit.getYear(), 
dtV2Lit.getMonth(), dtV2Lit.getDay(),
-                                dtV2Lit.getHour(), dtV2Lit.getMinute(), 
dtV2Lit.getSecond(),
-                                dtV2Lit.getMicroSecond());
-                    }

Review Comment:
   This loses the wildcard-scale handling that the old branch had. 
`characterLiteralTypeCoercion` is called with `TimeStampTzType.WILDCARD` during 
signature probes; now that value is passed directly into 
`TimestampTzLiteral.fromSessionTimeZone`, and the literal constructor calls 
`roundMicroSecond(dateType.getScale())`. For the wildcard type that scale is 
`-1`, so the precondition fails, the catch block returns `Optional.empty`, and 
the unchanged `TypeCoercionUtilsTest.testCharacterLiteralTypeCoercion` will hit 
`.get()` on an empty result for `"2023-08-17T01:41:18Z"`. Please keep the 
helper, but normalize negative/wildcard TIMESTAMPTZ scales from the input 
string before constructing the literal, as the previous code did.



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