nonbinaryprogrammer commented on a change in pull request #6861:
URL: https://github.com/apache/geode/pull/6861#discussion_r717879843
##########
File path:
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSortedSet.java
##########
@@ -607,6 +669,87 @@ private void addIfMatching(GlobPattern matchPattern,
List<byte[]> resultList, by
}
}
+ private void computeIntersection(List<RedisSortedSet> sets, ZAggregator
aggregator) {
+ RedisSortedSet retVal = new RedisSortedSet(Collections.emptyList(), new
double[] {});
+ RedisSortedSet smallestSet = sets.get(0);
+
+ for (RedisSortedSet set : sets) {
+ if (set.getSortedSetSize() < smallestSet.getSortedSetSize()) {
+ smallestSet = set;
+ }
+ }
+
+ for (byte[] member : smallestSet.members.keySet()) {
+ Double newScore;
+ if (aggregator.equals(ZAggregator.SUM)) {
+ newScore = getSumOfScoresForMember(sets, member);
+ } else if (aggregator.equals(ZAggregator.MAX)) {
+ newScore = getMaxScoreForMember(sets, member);
+ } else {
+ newScore = getMinScoreForMember(sets, member);
+ }
+
+ if (newScore != null) {
+ if (newScore.isNaN()) {
Review comment:
Yes, I believe it is now unnecessary because the ZAggregator function
that is applied doesn't ever return null.
--
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]