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);