xiaohui-sun commented on a change in pull request #4176: [TE] anomaly detector 
interface change and implementation for rule-based detection
URL: https://github.com/apache/incubator-pinot/pull/4176#discussion_r279575534
 
 

 ##########
 File path: 
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/components/ThresholdRuleDetector.java
 ##########
 @@ -87,8 +91,38 @@
     df.mapInPlace(BooleanSeries.HAS_TRUE, COL_ANOMALY, COL_TOO_HIGH, 
COL_TOO_LOW);
 
     DatasetConfigDTO datasetConfig = 
data.getDatasetForMetricId().get(me.getId());
-    return DetectionUtils.makeAnomalies(slice, df, COL_ANOMALY, endTime,
+    List<MergedAnomalyResultDTO> anomalies = 
DetectionUtils.makeAnomalies(slice, df, COL_ANOMALY, endTime,
         DetectionUtils.getMonitoringGranularityPeriod(monitoringGranularity, 
datasetConfig), datasetConfig);
+    return DetectionResult.from(anomalies, 
TimeSeries.fromDataFrame(constructThresholdBoundaries(df)));
+  }
+
+  @Override
+  public TimeSeries computePredictedTimeSeries(MetricSlice slice) {
+    InputData data =
+        this.dataFetcher.fetchData(new 
InputDataSpec().withTimeseriesSlices(Collections.singletonList(slice)));
+    DataFrame df = data.getTimeseries().get(slice);
+    return TimeSeries.fromDataFrame(constructThresholdBoundaries(df));
+  }
+
+  private DataFrame constructThresholdBoundaries(DataFrame df) {
+    if (!Double.isNaN(this.min)) {
 
 Review comment:
   When will this.min be NaN?

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