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

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

commit b426baad2f209af14041167d569bb3e92871ea32
Author: Jihao Zhang <[email protected]>
AuthorDate: Thu Jun 25 11:29:14 2020 -0700

    [TE] alert search - allow search by both metrics and datasets
---
 .../dashboard/resources/v2/alerts/AlertSearcher.java     | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/alerts/AlertSearcher.java
 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/alerts/AlertSearcher.java
index 23fc6fe..ac8a090 100644
--- 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/alerts/AlertSearcher.java
+++ 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/dashboard/resources/v2/alerts/AlertSearcher.java
@@ -194,15 +194,23 @@ public class AlertSearcher {
     Set<Long> metricIds = new HashSet<>();
     if (!searchFilter.getMetrics().isEmpty()) {
       for (String metric : searchFilter.getMetrics()) {
-        metricIds =
-            
this.metricDAO.findByMetricName(metric).stream().map(AbstractDTO::getId).collect(Collectors.toSet());
+        metricIds.addAll(
+            
this.metricDAO.findByMetricName(metric).stream().map(AbstractDTO::getId).collect(Collectors.toSet()));
       }
     }
 
     if (!searchFilter.getDatasets().isEmpty()) {
+      Set<Long> metricIdsFromDataset = new HashSet<>();
       for (String dataset : searchFilter.getDatasets()) {
-        metricIds.retainAll(
-            
this.metricDAO.findByDataset(dataset).stream().map(AbstractDTO::getId).collect(Collectors.toSet()));
+        
metricIdsFromDataset.addAll(this.metricDAO.findByPredicate(Predicate.LIKE("dataset",
 "%" + dataset + "%"))
+            .stream()
+            .map(AbstractDTO::getId)
+            .collect(Collectors.toSet()));
+      }
+      if (!searchFilter.getMetrics().isEmpty()) {
+        metricIds.retainAll(metricIdsFromDataset);
+      } else {
+        metricIds = metricIdsFromDataset;
       }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to