hanahmily commented on a change in pull request #5202:
URL: https://github.com/apache/skywalking/pull/5202#discussion_r466067440



##########
File path: 
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetricsQueryDAO.java
##########
@@ -76,5 +87,45 @@ public static IntValues sortValues(IntValues origin, 
List<String> expectedOrder,
             }
             return origin;
         }
+
+        /**
+         * Compose the multiple metric result based on conditions.
+         */
+        public static List<MetricsValues> composeLabelValue(final 
MetricsCondition condition,
+            final List<String> labels,
+            final List<String> ids,
+            final Map<String, DataTable> idMap) {
+            List<String> allLabels;
+            if (Objects.isNull(labels) || labels.size() < 1) {
+                allLabels = idMap.values().stream()
+                    .flatMap(dataTable -> dataTable.keys().stream())
+                    .distinct().collect(Collectors.toList());
+            } else {
+                allLabels = labels;
+            }
+            final int defaultValue = 
ValueColumnMetadata.INSTANCE.getDefaultValue(condition.getName());
+            return allLabels.stream()
+                .flatMap(label -> ids.stream()
+                    .map(id -> Tuple.of(
+                        label,
+                        id,
+                        Optional.ofNullable(idMap.getOrDefault(id, new 
DataTable()).get(label)).orElse(0L))))

Review comment:
       I should be `defaultValue`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to