Fix `index out of bounds exception` in `aggregate_labels` MQE function(#11045) (#11112)

This commit is contained in:
weixiang1862 2023-07-19 13:47:02 +08:00 committed by GitHub
parent 88fb1faceb
commit 283a860165
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -49,6 +49,7 @@
* Bump up graphql-java to 21.0.
* Apply MQE on Virtual-Cache layer UI-templates
* Add Echo component ID(5015) language: Golang.
* Fix `index out of bounds exception` in `aggregate_labels` MQE function.
#### UI

View File

@ -32,6 +32,7 @@ import org.apache.skywalking.oap.query.graphql.type.mql.ExpressionResult;
import org.apache.skywalking.oap.query.graphql.type.mql.MQEValue;
import org.apache.skywalking.oap.query.graphql.type.mql.MQEValues;
import org.apache.skywalking.oap.query.graphql.type.mql.Metadata;
import org.apache.skywalking.oap.server.library.util.CollectionUtils;
public class AggregateLabelsOp {
@ -54,6 +55,9 @@ public class AggregateLabelsOp {
private static ExpressionResult aggregateLabeledValueResult(ExpressionResult expResult,
AggregateLabelsFuncFactory factory) {
List<MQEValues> results = expResult.getResults();
if (CollectionUtils.isEmpty(results)) {
return expResult;
}
List<MQEValue> combineTo = results.get(0).getValues();
for (int i = 0; i < combineTo.size(); i++) {