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


##########
fe/fe-core/src/main/java/org/apache/doris/rewrite/FEFunctions.java:
##########
@@ -114,18 +124,54 @@ public static DateLiteral yearsAdd(LiteralExpr date, 
LiteralExpr year) throws An
         return dateLiteral.plusYears((int) year.getLongValue());
     }
 
+    @FEFunction(name = "years_add", argTypes = { "DATEV2", "INT" }, returnType 
= "DATEV2")
+    public static DateLiteral yearsAddDateV2(LiteralExpr date, LiteralExpr 
year) throws AnalysisException {
+        DateLiteral dateLiteral = (DateLiteral) date;
+        return dateLiteral.plusYears(year.getLongValue());
+    }
+
+    @FEFunction(name = "years_add", argTypes = { "DATETIMEV2", "INT" }, 
returnType = "DATETIMEV2")
+    public static DateLiteral yearsAddDateTimeV2(LiteralExpr date, LiteralExpr 
year) throws AnalysisException {
+        DateLiteral dateLiteral = (DateLiteral) date;
+        return dateLiteral.plusYears(year.getLongValue());
+    }
+
     @FEFunction(name = "months_add", argTypes = { "DATETIME", "INT" }, 
returnType = "DATETIME")
     public static DateLiteral monthsAdd(LiteralExpr date, LiteralExpr month) 
throws AnalysisException {
         DateLiteral dateLiteral = (DateLiteral) date;
         return dateLiteral.plusMonths((int) month.getLongValue());
     }
 
+    @FEFunction(name = "months_add", argTypes = { "DATEV2", "INT" }, 
returnType = "DATEV2")
+    public static DateLiteral monthsAddDateV2(LiteralExpr date, LiteralExpr 
month) throws AnalysisException {
+        DateLiteral dateLiteral = (DateLiteral) date;
+        return dateLiteral.plusYears(month.getLongValue());

Review Comment:
   ```suggestion
           return dateLiteral.plusMonths(month.getLongValue());
   ```



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to