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



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

Review comment:
       I used to follow copy and past strategy but found it would bring more 
mess more than what I expect. Unlike Es, H2 and Influxdb don't fetch all data 
before composing the final result object. That causes I have to tweak the 
current algorithm unavoidably. Future more, there are too many iterations that 
bring some performance concerns, I want to optimize it in the new implement. 
   
   
   




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