infdahai commented on code in PR #1444:
URL: 
https://github.com/apache/incubator-kvrocks/pull/1444#discussion_r1197868818


##########
src/types/redis_set.cc:
##########
@@ -338,19 +338,42 @@ rocksdb::Status Set::Inter(const std::vector<Slice> 
&keys, std::vector<std::stri
   for (const auto &member : target_members) {
     member_counters[member] = 1;
   }
+
+  bool has_limit = limit > 0;
   for (size_t i = 1; i < keys.size(); i++) {
     s = Members(keys[i], &target_members);
     if (!s.ok() || target_members.empty()) return s;
     for (const auto &member : target_members) {
-      if (member_counters.find(member) == member_counters.end()) continue;
+      if (member_counters.count(member) == 0) continue;
       member_counters[member]++;
+      if (has_limit && member_counters[member] == keys.size()) {
+        members->emplace_back(member);
+        if (--limit == 0) {
+          limit = -1;

Review Comment:
   oh, I forgot this 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to