You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/05/16 02:17:36 UTC

[GitHub] [skywalking-banyandb-java-client] lujiajing1126 commented on a diff in pull request #13: Add topN impl

lujiajing1126 commented on code in PR #13:
URL: https://github.com/apache/skywalking-banyandb-java-client/pull/13#discussion_r873278787


##########
src/main/java/org/apache/skywalking/banyandb/v1/client/MeasureQuery.java:
##########
@@ -89,6 +98,18 @@ public MeasureQuery sumBy(String field, Set<String> groupByKeys) {
         return this;
     }
 
+    public MeasureQuery topN(int number, String field) {
+        Preconditions.checkArgument(fieldProjections.contains(field), "field should be selected first");
+        this.topN = new TopN(field, number, Sort.DESC);
+        return this;
+    }
+
+    public MeasureQuery bottomN(int number, String field) {
+        Preconditions.checkArgument(fieldProjections.contains(field), "field should be selected first");
+        this.topN = new TopN(field, number, Sort.ASC);
+        return this;
+    }

Review Comment:
   docs updated



-- 
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: notifications-unsubscribe@skywalking.apache.org

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