Add support for new BITOP operations: DIFF, DIFF1, ANDOR, ONE#3690
Merged
petyaslavova merged 4 commits intomasterfrom Jul 7, 2025
Merged
Add support for new BITOP operations: DIFF, DIFF1, ANDOR, ONE#3690petyaslavova merged 4 commits intomasterfrom
petyaslavova merged 4 commits intomasterfrom
Conversation
petyaslavova
reviewed
Jul 4, 2025
tests/test_asyncio/test_commands.py
Outdated
| assert int(binascii.hexlify(await r.get("res3")), 16) == 0x000000FF | ||
|
|
||
| @pytest.mark.onlynoncluster | ||
| @skip_if_server_version_lt("8.2.0") |
Collaborator
There was a problem hiding this comment.
The server still returns 8.1.xxx as server version, and those new tests will be skipped. I suggest to define this rule as @skip_if_server_version_lt("8.1.224"). It can be updated later, when server version is update.
petyaslavova
approved these changes
Jul 7, 2025
petyaslavova
pushed a commit
that referenced
this pull request
Jul 25, 2025
* Add support for new BITOP operations: DIFF, DIFF1, ANDOR, ONE * fix linting issues * change version checking from 8.2.0 to 8.1.224
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for four new BITOP operations that will be available in Redis 8.2+: DIFF, DIFF1, ANDOR, and ONE. These operations extend Redis bitmap functionality to support common set operations that previously required multiple commands or Lua scripts.
New Operations
BITOP DIFF: Returns members of the first bitmap that are not members of any other bitmaps (X ∧ ¬(Y1 ∨ Y2 ∨ ...))
BITOP DIFF1: Returns members of any bitmap except the first that are not members of the first bitmap (¬X ∧ (Y1 ∨ Y2 ∨ ...))
BITOP ANDOR: Returns members of the first bitmap that are also members of one or more other bitmaps (X ∧ (Y1 ∨ Y2 ∨ ...))
BITOP ONE: Returns members of exactly one of the given bitmaps (generalized XOR for multiple keys)
Changes Made
Tests: Added comprehensive test coverage for all four new operations
Synchronous tests in tests/test_commands.py
Asynchronous tests in tests/test_asyncio/test_commands.py
Tests include bitwise logic verification, edge cases, and return value validation
All tests gated with @skip_if_server_version_lt("8.2.0") for compatibility