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

[GitHub] [doris] englefly commented on a diff in pull request #18275: [Enhancement](Nereids)add datelikev2 type support for fold constant.

englefly commented on code in PR #18275:
URL: https://github.com/apache/doris/pull/18275#discussion_r1155118195


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ExecutableFunctions.java:
##########
@@ -592,13 +592,18 @@ public static Literal divideDecimalV3(DecimalV3Literal first, DecimalV3Literal s
                 t1.getPrecision(), t1.getScale() - t2.getScale()), result);
     }
 
+    @ExecFunction(name = "date_sub", argTypes = { "DATE", "INT" }, returnType = "DATE")
+    public static DateLiteral dateSub(DateLiteral date, IntegerLiteral day) throws AnalysisException {
+        return dateAdd(date, new IntegerLiteral(-day.getValue()));
+    }
+
     @ExecFunction(name = "date_sub", argTypes = { "DATETIME", "INT" }, returnType = "DATETIME")
     public static DateTimeLiteral dateSub(DateTimeLiteral date, IntegerLiteral day) throws AnalysisException {
         return dateAdd(date, new IntegerLiteral(-day.getValue()));
     }
 
-    @ExecFunction(name = "date_sub", argTypes = { "DATE", "INT" }, returnType = "DATE")
-    public static DateLiteral dateSub(DateLiteral date, IntegerLiteral day) throws AnalysisException {
+    @ExecFunction(name = "date_sub", argTypes = { "DATEV2", "INT" }, returnType = "DATEV2")

Review Comment:
   it is better to line595-599 to line 604 in order to save review effort.



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