You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ji...@apache.org on 2019/04/24 23:06:40 UTC

[incubator-pinot] branch master updated: [TE] anomalies endpoint to work with new baseline provider (#4161)

This is an automated email from the ASF dual-hosted git repository.

jihao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new f3f77ed  [TE] anomalies endpoint to work with new baseline provider (#4161)
f3f77ed is described below

commit f3f77ed6998a9e3cba83f123876b4b062fd0ecef
Author: Jihao Zhang <ji...@linkedin.com>
AuthorDate: Wed Apr 24 16:06:31 2019 -0700

    [TE] anomalies endpoint to work with new baseline provider (#4161)
    
    PR4147 added current, baseline, upper and lower bound in the baseline provider interface. This will cause the time series alignment fails in anomalies endpoint for anomalies with the new baseline provider implementation. This PR fixes it.
---
 .../thirdeye/dashboard/resources/v2/AnomaliesResource.java  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/AnomaliesResource.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/AnomaliesResource.java
index e0fea7f..461ffe3 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/AnomaliesResource.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/AnomaliesResource.java
@@ -1130,10 +1130,17 @@ public class AnomaliesResource {
         .withStart(new DateTime(sliceAnomalyCurrent.getStart(), dataTimeZone).minus(offsets.getPreOffsetPeriod()).getMillis())
         .withEnd(new DateTime(sliceAnomalyCurrent.getEnd(), dataTimeZone).plus(offsets.getPostOffsetPeriod()).getMillis());
 
-    DataFrame dfCurrent = this.timeSeriesLoader.load(sliceViewCurrent);
     DataFrame dfBaseline = DetectionUtils.getBaselineTimeseries(anomaly, filters, metric.getId(), config, sliceViewCurrent.getStart(), sliceViewCurrent.getEnd(), this.loader, this.provider).getDataFrame();
-    DataFrame dfAligned = dfCurrent.renameSeries(COL_VALUE, COL_CURRENT).joinOuter(
-        dfBaseline.renameSeries(COL_VALUE, COL_BASELINE));
+    DataFrame dfAligned;
+    if (dfBaseline.contains(COL_CURRENT)) {
+      // if baseline provider returns both current values and baseline values, using them as the result
+      dfAligned = dfBaseline;
+      dfAligned.renameSeries(COL_VALUE, COL_BASELINE);
+    } else {
+      // otherwise fetch current values and join the time series to generate the result
+      DataFrame dfCurrent = this.timeSeriesLoader.load(sliceViewCurrent);
+      dfAligned = dfCurrent.renameSeries(COL_VALUE, COL_CURRENT).joinOuter(dfBaseline.renameSeries(COL_VALUE, COL_BASELINE));
+    }
 
     details.setDates(makeStringDates(dfAligned.getLongs(COL_TIME)));
     details.setCurrentValues(makeStringValues(dfAligned.getDoubles(COL_CURRENT)));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org