twalthr commented on a change in pull request #6614: [FLINK-9432] [table] Support extract timeunit: DECADE, EPOCH, ISODOW, ISOYEAR… URL: https://github.com/apache/flink/pull/6614#discussion_r221624182
########## File path: flink-libraries/flink-table/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java ########## @@ -719,7 +724,13 @@ public static long timestampStringToUnixDate(String s) { } public static long unixDateExtract(TimeUnitRange range, long date) { - return julianExtract(range, (int) date + EPOCH_JULIAN); + switch (range) { + case EPOCH: + // no need to extract year/month/day, just multiply + return date * SECONDS_PER_DAY; + default: + return julianExtract(range, (int) date + EPOCH_JULIAN); + } } private static int julianExtract(TimeUnitRange range, int julian) { Review comment: This class should not be changed. It is copied from Calcite until a certain issue is fixed. If we apply changes here, then just to update it to the latest Calcite code base. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services