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

[GitHub] [doris] sohardforaname commented on a diff in pull request #18209: [Feature](Nereids)add executable function to support fold constant for functions.

sohardforaname commented on code in PR #18209:
URL: https://github.com/apache/doris/pull/18209#discussion_r1189458379


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteral.java:
##########
@@ -204,4 +214,13 @@ public DateLiteral plusYears(int years) {
         LocalDateTime dateTime = DateUtils.getTime(DATE_FORMATTER, getStringValue()).plusYears(years);
         return new DateLiteral(dateTime.getYear(), dateTime.getMonthValue(), dateTime.getDayOfMonth());
     }
+
+    public LocalDateTime toJavaDateType() {
+        return LocalDateTime.of(((int) getYear()), ((int) getMonth()), ((int) getDay()), 0, 0, 0);
+    }
+
+    public static DateLiteral fromJavaDateType(LocalDateTime dateTime) {
+        return isDateOutOfRange(dateTime) ? null

Review Comment:
   it will throw exception



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