jihaozh commented on a change in pull request #4190: [TE] pass predicted time
series thought out the detection pipeline
URL: https://github.com/apache/incubator-pinot/pull/4190#discussion_r282182826
##########
File path:
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/wrapper/AnomalyDetectorWrapper.java
##########
@@ -201,8 +206,58 @@ public DetectionPipelineResult run() throws Exception {
anomaly.getProperties().put(PROP_DETECTOR_COMPONENT_NAME,
this.detectorName);
}
long lastTimeStamp = this.getLastTimeStamp();
- return new DetectionPipelineResult(anomalies.stream().filter(anomaly ->
anomaly.getEndTime() <= lastTimeStamp).collect(
- Collectors.toList()), lastTimeStamp);
+ List<MergedAnomalyResultDTO> anomalyResults =
anomalies.stream().filter(anomaly -> anomaly.getEndTime() <=
lastTimeStamp).collect(
+ Collectors.toList());
+ PredictionResult predictedTimeSeries = new
PredictionResult(this.detectorName, this.metricUrn,
predictedResult.getDataFrame());
+ return new DetectionPipelineResult(anomalyResults, lastTimeStamp,
Collections.singletonList(predictedTimeSeries));
+ }
+
+ /**
+ * Join two time series, including current, baseline, lower bound and upper
bound. If two time series have overlapped region, take the average
+ * @param ts1 timeseries 1
+ * @param ts2 timeseries 2
+ * @return the consolidated time series
+ */
+ static TimeSeries consolidateTimeSeries(TimeSeries ts1, TimeSeries ts2) {
Review comment:
For now, this is logic is only used here and seems very specific for this
purpose. What about we put it here for now, and refactor this to be a util
function if there is another use case.
----------------------------------------------------------------
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]