You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "morrySnow (via GitHub)" <gi...@apache.org> on 2023/06/18 04:21:50 UTC

[GitHub] [doris] morrySnow commented on a diff in pull request #20863: [fix](datetime) Fix the error in date calculation that includes constants

morrySnow commented on code in PR #20863:
URL: https://github.com/apache/doris/pull/20863#discussion_r1233187919


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignatureHelper.java:
##########
@@ -123,7 +124,13 @@ private static FunctionSignature defaultDateTimeV2PrecisionPromotion(
                 continue;
             }
             if (finalType == null) {
-                finalType = DateTimeV2Type.forType(arguments.get(i).getDataType());
+                if (arguments.get(i) instanceof VarcharLiteral) {

Review Comment:
   maybe u need use StringLikeLiteral



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java:
##########
@@ -78,6 +78,17 @@ public static DateTimeV2Type forType(DataType dataType) {
         return MAX;
     }
 
+    /**
+     * return proper type of datetimev2 for VarcharLiteral
+     * may be we need to check for validity?
+     */
+    public static DateTimeV2Type forTypeFromVarcharLiteral(String s) {

Review Comment:
   ```suggestion
       public static DateTimeV2Type forExpression(Expression e) {
           if (e instanceof StringLikeLiteral) {
               ....
           } else {
               return forType(e.getDataType());
           }
   ```



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org