KeeProMise commented on code in PR #57234:
URL: https://github.com/apache/doris/pull/57234#discussion_r2462354494


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/DateUtils.java:
##########
@@ -382,6 +382,30 @@ public static int getOrDefault(final TemporalAccessor 
accessor, final ChronoFiel
         return accessor.isSupported(field) ? accessor.get(field) : /* default 
value */ 0;
     }
 
+    /**
+     * get month from accessor, if not support day field, return 1
+     */
+    public static int getMonthOrDefault(final TemporalAccessor accessor) {
+        if (accessor.isSupported(ChronoField.MONTH_OF_YEAR)) {
+            return accessor.get(ChronoField.MONTH_OF_YEAR);
+        } else {
+            return 1;
+        }
+    }
+
+    /**
+     * get day from accessor, if not support day field, return 1
+     */
+    public static int getDayOrDefault(final TemporalAccessor accessor) {
+        if (accessor.isSupported(ChronoField.DAY_OF_MONTH)) {
+            return accessor.get(ChronoField.DAY_OF_MONTH);
+        } else if (accessor.isSupported(ChronoField.DAY_OF_YEAR)) {
+            return accessor.get(ChronoField.DAY_OF_YEAR);

Review Comment:
   done.



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