lujiajing1126 commented on code in PR #10448:
URL: https://github.com/apache/skywalking/pull/10448#discussion_r1118944320
##########
oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBAggregationQueryDAO.java:
##########
@@ -85,24 +60,45 @@ protected void apply(MeasureQuery query) {
throw new IOException("field spec is not registered");
}
+ if (schema.getTopNSpec() == null) {
+ throw new IOException("TopN spec is registered");
+ }
+
+ TopNQueryResponse resp = null;
+ if (condition.getOrder() == Order.DES) {
+ resp = topN(schema, timestampRange, condition.getTopN(),
additionalConditions);
+ } else {
+ resp = bottomN(schema, timestampRange, condition.getTopN(),
additionalConditions);
+ }
Review Comment:
> I mean there are two kinds of topN.
>
> 1. Where **service_id = xxx** and time_range in [start, end] Group by
entityID
> 2. Where and time_range in [start, end] Group by entityID
>
> Check the query condition protocol.
https://github.com/apache/skywalking-query-protocol/blob/450328c6445d4dc50a868a0b797a14755f1d82cc/metrics-v2.graphqls#L74-L75
BanyanDB supports post-aggregation as is hinted in the protocol
https://github.com/apache/skywalking-banyandb/blob/main/api/proto/banyandb/measure/v1/topn.proto#L62
I suppose it can serve the first case
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]