KKcorps commented on a change in pull request #8304:
URL: https://github.com/apache/pinot/pull/8304#discussion_r828433081



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/DateTimeFunctions.java
##########
@@ -715,4 +730,41 @@ public static String dateTimeConvert(String timeValueStr, 
String inputFormatStr,
       return new 
DateTimeFormatSpec(outputFormatStr).fromMillisToFormat(roundedTimeValueMs);
     }
   }
+
+  @ScalarFunction(names = {"timestampAdd", "dateAdd"})
+  public static long timestampAdd(String unit, int interval, long timestamp) {
+    ISOChronology chronology = ISOChronology.getInstanceUTC();
+    long millis = getTimestampField(chronology, unit).add(timestamp, interval);
+    return millis;
+  }
+
+  @ScalarFunction(names = {"timestampDiff", "dateDiff"})
+  public static long timestampDiff(String unit, long timestamp1, long 
timestamp2) {
+    ISOChronology chronology = ISOChronology.getInstanceUTC();
+    long millis = getTimestampField(chronology, 
unit).getDifferenceAsLong(timestamp1, timestamp2);

Review comment:
       done




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

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to