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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursDiff.java:
##########
@@ -42,11 +42,11 @@ public class HoursDiff extends ScalarFunction implements 
BinaryExpression, Expli
         PropagateNullable, DateDiffMonotonic {
 
     public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
-            FunctionSignature.ret(BigIntType.INSTANCE)
-                    .args(TimeStampTzType.WILDCARD, TimeStampTzType.WILDCARD),
             FunctionSignature.ret(BigIntType.INSTANCE)
                     .args(DateTimeV2Type.WILDCARD, DateTimeV2Type.WILDCARD),
-            
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, 
DateV2Type.INSTANCE));
+            
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, 
DateV2Type.INSTANCE),
+            FunctionSignature.ret(BigIntType.INSTANCE)
+                    .args(TimeStampTzType.WILDCARD, TimeStampTzType.WILDCARD));

Review Comment:
   [P1] Preserve instant semantics for all accepted zoned literal forms
   
   The timezone score is summed across both arguments, so a recognized zoned 
literal paired with a zone-less literal scores `+1 - 1 = 0` and ties 
DATETIMEV2. With `time_zone='America/Los_Angeles'`, `hours_diff('2021-03-14 
03:30:00-07:00', '2021-03-14 01:30:00')` therefore changes from 1 elapsed hour 
on the old TIMESTAMPTZ winner to 2 civil hours after moving this overload last. 
There is a second instance of the same policy gap where both inputs have 
explicit zones: the cast grammar accepts and normalizes compact `-0700`, but 
`DateTimeChecker` requires a colon before offset minutes, so pairing 
`2021-03-15 00:00:00-0700` with `2021-03-14 00:00:00-08:00` again ties and 
changes 23 elapsed hours to 24 civil hours. Please preserve TIMESTAMPTZ 
whenever an inspectable literal supplies any accepted explicit zone, using the 
same accepted grammar as the cast path, without reintroducing the 
all-uninspectable-VARCHAR fallback; add regressions for both mixed cases.



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