From 7a6c2544e354b6a4d6680106577ea59be2ec7763 Mon Sep 17 00:00:00 2001 From: ulixius9 Date: Thu, 19 Dec 2024 16:36:48 +0530 Subject: [PATCH] Fix #19141: Data Insight Tier Filter does not work --- .../jdbi3/DataInsightSystemChartRepository.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataInsightSystemChartRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataInsightSystemChartRepository.java index 5d02304282bc..d082445fcdc4 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataInsightSystemChartRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataInsightSystemChartRepository.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Set; import org.openmetadata.schema.dataInsight.custom.DataInsightCustomChart; @@ -87,7 +88,13 @@ public DataInsightCustomChartResultList getPreviewData( DataInsightCustomChart chart, long startTimestamp, long endTimestamp, String filter) throws IOException { if (chart.getChartDetails() != null && filter != null) { - ((LinkedHashMap) chart.getChartDetails()).put("filter", filter); + HashMap chartDetails = (LinkedHashMap) chart.getChartDetails(); + if (chartDetails.get("metrics") != null) { + for (LinkedHashMap metrics : + (List>) chartDetails.get("metrics")) { + metrics.put("filter ", filter); + } + } } return getPreviewData(chart, startTimestamp, endTimestamp); } @@ -110,7 +117,13 @@ public Map listChartData( if (chart != null) { if (chart.getChartDetails() != null && filter != null) { - ((LinkedHashMap) chart.getChartDetails()).put("filter", filter); + HashMap chartDetails = (LinkedHashMap) chart.getChartDetails(); + if (chartDetails.get("metrics") != null) { + for (LinkedHashMap metrics : + (List>) chartDetails.get("metrics")) { + metrics.put("filter ", filter); + } + } } DataInsightCustomChartResultList data = searchClient.buildDIChart(chart, startTimestamp, endTimestamp);