You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/03/11 17:19:25 UTC

[GitHub] [calcite] asereda-gs commented on a change in pull request #1099: [CALCITE-2908] Implement SQL LAST_DAY function

asereda-gs commented on a change in pull request #1099: [CALCITE-2908] Implement SQL LAST_DAY function
URL: https://github.com/apache/calcite/pull/1099#discussion_r264337052
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
 ##########
 @@ -1924,6 +1924,22 @@ public static int truncate(int v, int x) {
     return v - remainder;
   }
 
+  /** SQL {@code LAST_DAY} function. */
+  public static int lastDay(int date) {
+    int y0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.YEAR, date);
+    int m0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.MONTH, date);
+    int last = lastDay(y0, m0);
+    return DateTimeUtils.ymdToUnixDate(y0, m0, last);
+  }
+
+  public static int lastDay(long timestamp) {
 
 Review comment:
   Pls add javadoc for `timestamp` argument. Is it millis since epoch ? 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services