xiaohui-sun 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_r282196190
########## 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: Can we simply use joinOuter? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org