jdeppe-pivotal commented on a change in pull request #6794:
URL: https://github.com/apache/geode/pull/6794#discussion_r698812782



##########
File path: 
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSortedSet.java
##########
@@ -383,6 +387,44 @@ long zrevrank(byte[] member) {
     return null;
   }
 
+  long zunionstore(RegionProvider regionProvider, RedisKey key, List<RedisKey> 
sourceSets,
+      List<Double> weights, ZAggregator aggregator) {
+    for (int i = 0; i < sourceSets.size(); i++) {
+      RedisSortedSet set =
+          regionProvider.getTypedRedisData(REDIS_SORTED_SET, 
sourceSets.get(i), false);
+      if (set == NULL_REDIS_SORTED_SET) {
+        continue;
+      }
+      double weight = weights.get(i);
+
+      Iterator<AbstractOrderedSetEntry> scoreIterator =
+          set.scoreSet.getIndexRange(0, Integer.MAX_VALUE, false);
+      while (scoreIterator.hasNext()) {
+        OrderedSetEntry entry = (OrderedSetEntry) scoreIterator.next();
+        OrderedSetEntry existingValue = members.get(entry.member);
+        if (existingValue == null) {
+          byte[] score;
+          if (weight == 1) {

Review comment:
       I'm very reluctant to add premature optimizations especially for corner 
cases.




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


Reply via email to