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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to