DonalEvans commented on a change in pull request #6716:
URL: https://github.com/apache/geode/pull/6716#discussion_r675163156
##########
File path:
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSortedSet.java
##########
@@ -636,4 +663,48 @@ public int getSizeInBytes() {
return 0;
}
}
+
+ // Dummy entry used to find the rank of an element with the given member
name for lexically
+ // ordered sets
+ static class MemberDummyOrderedSetEntry extends AbstractOrderedSetEntry {
+ boolean isExclusive;
+ boolean isMinimum;
+
+ MemberDummyOrderedSetEntry(byte[] member, double score, boolean
isExclusive,
+ boolean isMinimum) {
+ this.member = member;
+ this.scoreBytes = null;
+ this.score = score;
+ this.isExclusive = isExclusive;
+ this.isMinimum = isMinimum;
+ }
+
+ @Override
+ public int compareMembers(byte[] array1, byte[] array2) {
+ int dummyNameComparison = checkDummyMemberNames(array1, array2);
+ if (dummyNameComparison != 0) {
+ return dummyNameComparison;
+ } else {
+ // If not using dummy member names, move on to actual lexical
comparison
+ int stringComparison = javaImplementationOfAnsiCMemCmp(array1, array2);
+ if (stringComparison == 0) {
+ if (isMinimum && isExclusive || !isMinimum && !isExclusive) {
Review comment:
Thanks for this! I was sure there must be a neater way of doing that but
I wasn't sure what it was. I applied the same change to the constructor of
`ScoreDummyOrderedSetEntry` which was the other case you saw.
--
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]