You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/05/04 18:15:54 UTC

[GitHub] [incubator-pinot] npawar commented on a change in pull request #5324: Timespec to datetimespec conversion utility

npawar commented on a change in pull request #5324:
URL: https://github.com/apache/incubator-pinot/pull/5324#discussion_r419631892



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/data/function/DateTimeFunctions.java
##########
@@ -35,9 +63,79 @@ static Long toEpochHours(Long millis) {
   }
 
   /**
-   * Convert epoch millis to epoch minutes, bucketed by given bucket granularity
+   * Convert epoch millis to epoch hours, bucketed by given bucket granularity
    */
-  static Long toEpochMinutes(Long millis, String bucket) {
-    return TimeUnit.MILLISECONDS.toMinutes(millis) / Integer.parseInt(bucket);
+  static Long toEpochHoursBucket(Long millis, String bucket) {

Review comment:
       Agreed, I don't like "bucket" here either, but couldn't think of a better one. Rounded does sound better, but i wonder if it'll be confusing.
   For example, consider millis 1578685189000 (2020/01/10 11:39:49)
   `toEpochSeconds(millis) = 1578685189`
   
   What we want is - `toEpochSeconds(millis, 10)` = 1578685189/10 = **157868518** i.e. divide the seconds to create **tenSecondsSinceEpoch**
   Rounding can be confused with - _keep the same format, but find the nearest 10 minutes value_. 
   `toEpochSecondsRounded(millis, 10)` = (1578685189/10) * 10 = **1578685180**
   
   Maybe we should solicit more opinions? Once this function starts being used, it'll be with us forever
   




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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org