feat(cf): add CF.COUNT command - #3650
ChaseForward wants to merge 1 commit into
Conversation
Return the number of occurrences of an item in a cuckoo filter by scanning the primary and secondary buckets of every sub-filter. Returns 0 if the filter does not exist. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Hi @ChaseForward, Thank you for your pull request. Please review our Contributing Guide. Please make sure you understand your changes and explain your reasoning in this pull request. Low-quality pull requests may be closed. |
| if (bucket1_idx != bucket2_idx) { | ||
| s = pages_.CountInBucket(filter_index_, num_buckets_, bucket2_idx, fingerprint, &c2); | ||
| if (!s.ok()) return s; | ||
| *count += c2; | ||
| } |
There was a problem hiding this comment.
Referring to the RedisBloom implementation: https://github.com/RedisBloom/RedisBloom/blob/a89aac8e75da4a1fbbb59a307ea2f3b4ae87870d/src/cuckoo.c#L197 , when bucket1_idx == bucket2_idx, RedisBloom may count the item twice. Should we follow RedisBloom's semantics? cc @jihuayu
There was a problem hiding this comment.
I think this is a bug in RedisBloom, and we don't need to follow its behavior.
|
Hi @ChaseForward Can you resolved the conficts. Thanks |
|
Thanks for your review and suggestion. I plan to complete these unit tests during the National Day holiday. My apologies for the prolonged delay. |
| /* Register commands | ||
| CF.RESERVE | ||
| CF.ADD | ||
| CF.COUNT | ||
| */ |
Description
This PR adds the CF.COUNT command, bringing RedisBloom compatibility to the cuckoo filter. It returns the number of occurrences of an item in a cuckoo filter by scanning the primary and secondary buckets of every sub-filter. Returns 0 if the filter does not exist.
Related
Split from #3591 as suggested (one command per PR). Builds on the cuckoo filter infrastructure from #3481.
Assisted by glm5.3.