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/08/10 17:52:59 UTC

[GitHub] [geode] dschneider-pivotal commented on a change in pull request #6735: GEODE-9184: Add Radish ZLEXCOUNT command

dschneider-pivotal commented on a change in pull request #6735:
URL: https://github.com/apache/geode/pull/6735#discussion_r686195561



##########
File path: geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSortedSet.java
##########
@@ -357,6 +357,27 @@ long zcount(SortedSetScoreRangeOptions rangeOptions) {
     return addLimitToRange(rangeOptions, withScores, minIndex, maxIndex);
   }
 
+  long zlexcount(SortedSetLexRangeOptions lexOptions) {
+    // Assume that all members have the same score. Behaviour is unspecified otherwise.
+    double score = scoreSet.get(0).score;
+
+    AbstractOrderedSetEntry minEntry = new MemberDummyOrderedSetEntry(lexOptions.getMinimum(),

Review comment:
       consider extracting these two blocks into getMinIndex(lexOptions, score) and getMaxIndex(lexOptions, score). These new methods could also be used by zrangebylex

##########
File path: geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSortedSet.java
##########
@@ -357,6 +357,27 @@ long zcount(SortedSetScoreRangeOptions rangeOptions) {
     return addLimitToRange(rangeOptions, withScores, minIndex, maxIndex);
   }
 
+  long zlexcount(SortedSetLexRangeOptions lexOptions) {
+    // Assume that all members have the same score. Behaviour is unspecified otherwise.
+    double score = scoreSet.get(0).score;

Review comment:
       Before you call get(0) do you need to do a check on scoreSet to see if it is empty?




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