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

akshayrai09 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 b4b457b  [TE] detection - merger max duration validation (#3966)
b4b457b is described below

commit b4b457bba207e8c808eadb088398e30029244e79
Author: Jihao Zhang <jihzh...@linkedin.com>
AuthorDate: Wed Mar 13 15:30:02 2019 -0700

    [TE] detection - merger max duration validation (#3966)
---
 .../apache/pinot/thirdeye/detection/algorithm/MergeWrapper.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/algorithm/MergeWrapper.java
 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/algorithm/MergeWrapper.java
index d8019c7..e2a3090 100644
--- 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/algorithm/MergeWrapper.java
+++ 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/algorithm/MergeWrapper.java
@@ -52,6 +52,7 @@ public class MergeWrapper extends DetectionPipeline {
   private static final String PROP_CLASS_NAME = "className";
   private static final String PROP_MERGE_KEY = "mergeKey";
   private static final String PROP_DETECTOR_COMPONENT_NAME = 
"detectorComponentName";
+  private static final int NUMBER_OF_SPLITED_ANOMALIES_LIMIT = 1000;
 
   protected static final Comparator<MergedAnomalyResultDTO> COMPARATOR = new 
Comparator<MergedAnomalyResultDTO>() {
     @Override
@@ -87,7 +88,7 @@ public class MergeWrapper extends DetectionPipeline {
 
     this.maxGap = MapUtils.getLongValue(config.getProperties(), "maxGap", 
TimeUnit.HOURS.toMillis(2));
     this.maxDuration = MapUtils.getLongValue(config.getProperties(), 
"maxDuration", Long.MAX_VALUE);
-    Preconditions.checkArgument(this.maxDuration > 0, "Max duration must be a 
positive number.");
+    Preconditions.checkArgument(this.maxDuration > 0 , "Max duration must be a 
positive number");
     this.slice = new AnomalySlice().withStart(startTime).withEnd(endTime);
     this.nestedProperties = new ArrayList<>();
     List<Map<String, Object>> nested = 
ConfigUtils.getList(config.getProperties().get(PROP_NESTED));
@@ -209,6 +210,10 @@ public class MergeWrapper extends DetectionPipeline {
   */
   private Collection<MergedAnomalyResultDTO> 
splitAnomaly(MergedAnomalyResultDTO anomaly, long maxDuration) {
     int anomalyCountAfterSplit = (int) Math.ceil((anomaly.getEndTime() - 
anomaly.getStartTime()) / (double) maxDuration);
+    if (anomalyCountAfterSplit > NUMBER_OF_SPLITED_ANOMALIES_LIMIT) {
+      // if the number of anomalies after split is more than the limit, don't 
split
+      return Collections.singleton(anomaly);
+    }
     Set<MergedAnomalyResultDTO> result = new HashSet<>();
 
     long nextStartTime = anomaly.getStartTime();


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

Reply via email to