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_r282246562
 
 

 ##########
 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 value in the right 
time series
+   * @param leftTimeSeries timeseries 1
+   * @param rightTimeSeries timeseries 2
+   * @return the consolidated time series
+   */
+  static TimeSeries consolidateTimeSeries(TimeSeries leftTimeSeries, 
TimeSeries rightTimeSeries) {
+    DataFrame df1 = leftTimeSeries.getDataFrame();
+    DataFrame df2 = rightTimeSeries.getDataFrame();
+    DataFrame joinedDf = df1.joinOuter(df2, COL_TIME);
+    consolidateJoinedDf(joinedDf, COL_VALUE);
 
 Review comment:
   yes.

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

Reply via email to