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/04 00:56:12 UTC

[GitHub] [doris] englefly commented on a diff in pull request #18331: [improve](nereids)compute statsRange.length() according to the column datatype

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/types/coercion/DateLikeType.java:
##########
@@ -17,8 +17,30 @@
 
 package org.apache.doris.nereids.types.coercion;
 
+import java.time.temporal.ChronoUnit;
+import java.util.Calendar;
+
 /**
  * date like type.
  */
 public abstract class DateLikeType extends PrimitiveType {
+    private Calendar toCalendar(double d) {
+        //d = (year * 10000 + month * 100 + day) * 1000000L;
+        int date = (int) (d / 1000000);
+        int day = date % 100;
+        int month = (date / 100) % 100;
+        int year = date / 10000;
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.YEAR, year);
+        calendar.set(Calendar.MONDAY, month);
+        calendar.set(Calendar.DAY_OF_MONTH, day);

Review Comment:
   currently, only support date/datev2.
   this function can be extended to support time if we need



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