You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/07/08 15:51:10 UTC

[GitHub] [geode] ringles commented on a change in pull request #6680: GEODE-9182: Implement Radish ZCOUNT command

ringles commented on a change in pull request #6680:
URL: https://github.com/apache/geode/pull/6680#discussion_r666282469



##########
File path: geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSortedSet.java
##########
@@ -462,5 +503,19 @@ public int compareTo(OrderedSetEntry o) {
       this.scoreBytes = score;
       this.score = processByteArrayAsDouble(score);
     }
+
+    // Dummy entry used to find the rank of an element with the given score for inclusive or
+    // exclusive ranges
+    OrderedSetEntry(double score, boolean isExclusive, boolean isMinimum) {
+      if (isExclusive && isMinimum || !isExclusive && !isMinimum) {
+        // For use in (this < other) and (this >= other) comparisons
+        this.member = bGREATEST_MEMBER_NAME;
+      } else {
+        // For use in (this <= other) and (this > other) comparisons
+        this.member = bLEAST_MEMBER_NAME;
+      }
+      this.scoreBytes = new byte[] {};
+      this.score = score;

Review comment:
       Do we need to allocate an empty array for scoreBytes? Maybe I'm missing a case, but if this doesn't get used could we just set it to null?

##########
File path: geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSortedSet.java
##########
@@ -289,7 +304,7 @@ long zcard() {
   }
 
   List<byte[]> zrange(int min, int max, boolean withScores) {
-    ArrayList<byte[]> result = new ArrayList<>();
+    List<byte[]> result = new ArrayList<>();

Review comment:
       Thanks for fixing that.

##########
File path: geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/collections/OrderStatisticsSet.java
##########
@@ -53,20 +53,20 @@
   T get(int index);
 
   /**
-   * Returns the index of <code>element</code> in the sorted set.
+   * Returns the index of <code>element</code> in the sorted set. If the element is not present in
+   * the set, returns the index it would have if it was present

Review comment:
       This is incredibly pedantic, but it's "if it were present". I feel ashamed just for typing that.




-- 
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@geode.apache.org

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