vincentchenjl commented on a change in pull request #4988: [TE] Support weekly
anomaly detection
URL: https://github.com/apache/incubator-pinot/pull/4988#discussion_r367158878
##########
File path:
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionUtils.java
##########
@@ -288,4 +288,39 @@ public static Period periodFromTimeUnit(int size,
TimeUnit unit) {
return new Period(TimeUnit.MILLISECONDS.convert(size, unit));
}
}
+
+ /**
+ * Aggregate the time series data frame's value to specified granularity
+ * @param df the data frame
+ * @param origin the aggregation origin time stamp
+ * @param granularityPeriod the aggregation granularity in period
+ * @return the aggregated time series data frame
+ */
+ public static DataFrame aggregateByPeriod(DataFrame df, long origin, Period
granularityPeriod) {
+ return df.groupByPeriod(df.getLongs(COL_TIME), new DateTime(origin),
granularityPeriod).sum(COL_TIME, COL_VALUE);
Review comment:
Can we pass the aggregation function as an argument
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]