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/06/16 20:51:49 UTC

[GitHub] [incubator-pinot] npawar commented on a change in pull request #5575: Function to round a time value

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



##########
File path: pinot-common/src/main/java/org/apache/pinot/common/function/DateTimeFunctions.java
##########
@@ -241,6 +241,15 @@ static Long fromDateTime(String dateTimeString, String pattern) {
     return DateTimePatternHandler.parseDateTimeStringToEpochMillis(dateTimeString, pattern);
   }
 
+
+  /**
+   * Round the given time value to nearest rounding bucket
+   */
+  @ScalarFunction
+  static Long round(Long timeValue, Number roundToNearest) {
+    return (timeValue / roundToNearest.intValue()) * roundToNearest.intValue();

Review comment:
       changed to roundToNearest.longValue and cached it




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