You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ap...@apache.org on 2018/11/28 01:57:55 UTC
[incubator-pinot] branch master updated: [TE] detection - copy
nested property in wrapper (#3562)
This is an automated email from the ASF dual-hosted git repository.
apucher 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 44c2859 [TE] detection - copy nested property in wrapper (#3562)
44c2859 is described below
commit 44c2859795cc487a0f6498e13cd9cd6c80354f86
Author: Jihao Zhang <ji...@linkedin.com>
AuthorDate: Tue Nov 27 17:57:51 2018 -0800
[TE] detection - copy nested property in wrapper (#3562)
---
.../thirdeye/detection/DetectionMigrationResource.java | 7 +++++--
.../linkedin/thirdeye/detection/algorithm/MergeWrapper.java | 6 +++++-
.../thirdeye/detection/wrapper/AnomalyFilterWrapper.java | 13 +++++++------
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/DetectionMigrationResource.java b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/DetectionMigrationResource.java
index c3d08d1..3b15748 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/DetectionMigrationResource.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/DetectionMigrationResource.java
@@ -99,7 +99,7 @@ public class DetectionMigrationResource {
yamlConfigs.put("metric", anomalyFunctionDTO.getMetric());
yamlConfigs.put("dataset", anomalyFunctionDTO.getCollection());
yamlConfigs.put("pipelineType", "Composite");
- if (anomalyFunctionDTO.getExploreDimensions() != null) {
+ if (StringUtils.isNotBlank(anomalyFunctionDTO.getExploreDimensions())) {
// dimension explore and data filter
yamlConfigs.put("dimensionExploration",
getDimensionExplorationParams(anomalyFunctionDTO));
@@ -180,7 +180,10 @@ public class DetectionMigrationResource {
filterYamlParams.put("pattern", "up_or_down");
filterYamlParams.put("sitewideMetricName", functionDTO.getGlobalMetric());
filterYamlParams.put("sitewideCollection", functionDTO.getCollection());
- filterYamlParams.put("filters", AnomalyDetectionInputContextBuilder.getFiltersForFunction(functionDTO.getGlobalMetricFilters()).asMap());
+ if (StringUtils.isNotBlank(functionDTO.getGlobalMetricFilters())) {
+ filterYamlParams.put("filters",
+ AnomalyDetectionInputContextBuilder.getFiltersForFunction(functionDTO.getGlobalMetricFilters()).asMap());
+ }
return filterYamlParams;
}
diff --git a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/algorithm/MergeWrapper.java b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/algorithm/MergeWrapper.java
index 3f8b0de..144bf5f 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/algorithm/MergeWrapper.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/algorithm/MergeWrapper.java
@@ -80,7 +80,11 @@ public class MergeWrapper extends DetectionPipeline {
this.maxGap = MapUtils.getLongValue(config.getProperties(), "maxGap", 0);
this.maxDuration = MapUtils.getLongValue(config.getProperties(), "maxDuration", Long.MAX_VALUE);
this.slice = new AnomalySlice().withStart(startTime).withEnd(endTime);
- this.nestedProperties = ConfigUtils.getList(config.getProperties().get(PROP_NESTED));
+ this.nestedProperties = new ArrayList<>();
+ List<Map<String, Object>> nested = ConfigUtils.getList(config.getProperties().get(PROP_NESTED));
+ for (Map<String, Object> properties : nested) {
+ this.nestedProperties.add(new HashMap<>(properties));
+ }
}
@Override
diff --git a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/wrapper/AnomalyFilterWrapper.java b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/wrapper/AnomalyFilterWrapper.java
index dba5f80..429b537 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/wrapper/AnomalyFilterWrapper.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/wrapper/AnomalyFilterWrapper.java
@@ -28,6 +28,7 @@ import com.linkedin.thirdeye.detection.DetectionUtils;
import com.linkedin.thirdeye.detection.spi.components.AnomalyFilter;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.MapUtils;
@@ -46,8 +47,7 @@ public class AnomalyFilterWrapper extends DetectionPipeline {
private final AnomalyFilter anomalyFilter;
private String metricUrn;
- public AnomalyFilterWrapper(DataProvider provider, DetectionConfigDTO config, long startTime, long endTime)
- throws Exception {
+ public AnomalyFilterWrapper(DataProvider provider, DetectionConfigDTO config, long startTime, long endTime) {
super(provider, config, startTime, endTime);
Map<String, Object> properties = config.getProperties();
this.nestedProperties = ConfigUtils.getList(properties.get(PROP_NESTED));
@@ -72,13 +72,14 @@ public class AnomalyFilterWrapper extends DetectionPipeline {
DetectionConfigDTO nestedConfig = new DetectionConfigDTO();
Preconditions.checkArgument(properties.containsKey(PROP_CLASS_NAME), "Nested missing " + PROP_CLASS_NAME);
+ HashMap<String, Object> nestedProp = new HashMap<>(properties);
+ if (this.metricUrn != null){
+ nestedProp.put(PROP_METRIC_URN, this.metricUrn);
+ }
nestedConfig.setId(this.config.getId());
nestedConfig.setName(this.config.getName());
- nestedConfig.setProperties(properties);
+ nestedConfig.setProperties(nestedProp);
nestedConfig.setComponents(this.config.getComponents());
- if (this.metricUrn != null){
- properties.put(PROP_METRIC_URN, this.metricUrn);
- }
DetectionPipeline pipeline = this.provider.loadPipeline(nestedConfig, this.startTime, this.endTime);
DetectionPipelineResult intermediate = pipeline.run();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org