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 2022/01/05 17:08:19 UTC

[GitHub] [geode] BalaKaza commented on a change in pull request #7236: GEODE-9829: Add SINTER command to Redis supported commands.

BalaKaza commented on a change in pull request #7236:
URL: https://github.com/apache/geode/pull/7236#discussion_r778990629



##########
File path: geode-for-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSet.java
##########
@@ -110,6 +111,47 @@ private static MemberSet calculateDiff(RegionProvider regionProvider, List<Redis
     return diff;
   }
 
+  public static Set<byte[]> sinter(RegionProvider regionProvider, List<RedisKey> keys) {
+    MemberSet result = calculateInter(regionProvider, keys);
+    if (result == null) {
+      return Collections.emptySet();
+    }
+    return result;
+  }
+
+  private static MemberSet calculateInter(RegionProvider regionProvider, List<RedisKey> keys) {
+    List<RedisSet> sets = new ArrayList<>(keys.size());
+    RedisSet smallestSet = null;
+
+    for (RedisKey key : keys) {
+      RedisSet redisSet = regionProvider.getTypedRedisData(REDIS_SET, key, true);
+      if (redisSet == NULL_REDIS_SET || redisSet.scard() == 0) {
+        return null;

Review comment:
       Makes Sense. Will be returning `new MemberSet()` as that is the return type.




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