Add support for new operations of BITOP command in Redis Community Edition 8.2#3334
Merged
atakavci merged 3 commits intoredis:mainfrom Jul 7, 2025
Merged
Add support for new operations of BITOP command in Redis Community Edition 8.2#3334atakavci merged 3 commits intoredis:mainfrom
atakavci merged 3 commits intoredis:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for the new BITOP operations (DIFF, DIFF1, ANDOR, ONE) introduced in Redis Community Edition 8.2.
- Defines new commands in
RedisStringCommands, clusterNodeSelectionString*Commands, and their async/reactive variants - Extends
CommandKeyword,RedisCommandBuilder, and test suites (integration and builder unit tests) to handle the added operations
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/io/lettuce/core/commands/BitCommandIntegrationTests.java | Added integration tests for DIFF, DIFF1, ANDOR, ONE |
| src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java | Added unit tests for command encoding of new ops |
| src/main/templates/io/lettuce/core/api/RedisStringCommands.java | Declared new bitopDiff, bitopDiff1, bitopAndor, bitopOne methods |
| src/main/java/io/lettuce/core/protocol/CommandKeyword.java | Added DIFF, DIFF1, ANDOR, ONE keywords |
| src/main/java/io/lettuce/core/RedisCommandBuilder.java | Implemented builder methods for new operations |
| src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java | Added reactive overrides for new operations |
| src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java | Added async overrides for new operations |
| src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionStringCommands.java | Declared cluster sync variants of new methods |
| src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionStringAsyncCommands.java | Declared cluster async variants of new methods |
Comments suppressed due to low confidence (1)
src/test/java/io/lettuce/core/commands/BitCommandIntegrationTests.java:512
- [nitpick] The comment is misleading—ANDOR takes one source key and at least one additional key. Consider updating it to reflect that only one comparison key is required.
// ANDOR requires at least two keys - test with empty second key
|
|
||
| @Test | ||
| void bitopDiff() { | ||
| assumeTrue(RedisConditions.of(redis).hasVersionGreaterOrEqualsTo("8.1.240")); |
There was a problem hiding this comment.
The version check threshold for these new BITOP operations should be updated to Redis 8.2.0 (e.g., "8.2.0") instead of "8.1.240" to align with their official introduction.
Suggested change
| assumeTrue(RedisConditions.of(redis).hasVersionGreaterOrEqualsTo("8.1.240")); | |
| assumeTrue(RedisConditions.of(redis).hasVersionGreaterOrEqualsTo("8.2.0")); |
Collaborator
|
LGTM. @tishun WDYT? |
uglide
approved these changes
Jul 2, 2025
kiryazovi-redis
pushed a commit
to kiryazovi-redis/lettuce-test-infra
that referenced
this pull request
Jul 9, 2025
…ition 8.2 (redis#3334) * bitop new operations * polish * update new API signatures in NodeSelectionCommands
svc-squareup-copybara
pushed a commit
to cashapp/misk
that referenced
this pull request
Aug 8, 2025
| Package | Type | Package file | Manager | Update | Change | |---|---|---|---|---|---| | [io.lettuce:lettuce-core](https://github.com/redis/lettuce) | dependencies | misk/gradle/libs.versions.toml | gradle | minor | `6.7.1.RELEASE` -> `6.8.0.RELEASE` | | [com.squareup.wire](https://github.com/square/wire) | plugin | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7` -> `5.3.8` | | [com.squareup.wire:wire-schema](https://github.com/square/wire) | dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7` -> `5.3.8` | | [com.squareup.wire:wire-runtime](https://github.com/square/wire) | dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7` -> `5.3.8` | | [com.squareup.wire:wire-reflector](https://github.com/square/wire) | dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7` -> `5.3.8` | | [com.squareup.wire:wire-moshi-adapter](https://github.com/square/wire) | dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7` -> `5.3.8` | | [com.squareup.wire:wire-grpc-client](https://github.com/square/wire) | dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7` -> `5.3.8` | | [com.squareup.wire:wire-bom](https://github.com/square/wire) | dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7` -> `5.3.8` | --- ### Release Notes <details> <summary>redis/lettuce (io.lettuce:lettuce-core)</summary> ### [`v6.8.0.RELEASE`](https://github.com/redis/lettuce/releases/tag/6.8.0.RELEASE) [Compare Source](redis/lettuce@6.7.1.RELEASE...6.8.0.RELEASE) The Lettuce team is pleased to announce the Lettuce 6.8.0 minor release! This release provides support for the newly introduced [Redis Query Engine support](https://redis.github.io/lettuce/user-guide/redis-search/) which was is part of Redis 8.0 and previously - as part of RedisStack. The new operators (`DIFF`, `DIFF1`, `ANDOR` and `ONE`) for the `BITOP` command are also available. The team has worked on extending the contract of the `XADD` and `XTRIM ` commands to support trimming policy, and also introduced the new `XDELEX` and `XACKDEL` commands. Lettuce 6.8.0 supports Redis 2.6+ up to Redis 8.x. In terms of Java runtime, Lettuce requires at least Java 8 and works with Java 24. The driver is tested against Redis 8.2, Redis 8.0, Redis 7.4 and Redis 7.2. Find the full changelog at the end of this document. Thanks to all contributors who made Lettuce 6.8.0.RELEASE possible. 📗 Links Reference documentation: https://lettuce.io/core/6.8.0.RELEASE/reference/ Javadoc: https://lettuce.io/core/6.8.0.RELEASE/api/ ⭐ New Features Introduce RediSearch by [@​tishun](https://github.com/tishun) in redis/lettuce#3375 Add support for new operations of BITOP command in Redis Community Edition 8.2 by [@​atakavci](https://github.com/atakavci) in redis/lettuce#3334 Add support for 8.2 stream commands by [@​uglide](https://github.com/uglide) in redis/lettuce#3374 🐞 Bug Fixes NoClassDefFoundError in Lettuce 6.7.0 [#​3317](redis/lettuce#3317) by [@​tishun](https://github.com/tishun) in redis/lettuce#3318 💡 Other The instance of the `ObjectMapper` can now be reused in the `DefaultJsonParser` by [@​thachlp](https://github.com/thachlp) in redis/lettuce#3372 Added basic connection interruption tests by [@​uglide](https://github.com/uglide) in redis/lettuce#3292 DOC-4758 async JSON doc examples by [@​andy-stark-redis](https://github.com/andy-stark-redis) in redis/lettuce#3335 Fixed SocketOptions.Builder validation messages by [@​hubertchylik](https://github.com/hubertchylik) in redis/lettuce#3366 Refactor tests for clarity and maintainability by [@​Rian-Ismael](https://github.com/Rian-Ismael) in redis/lettuce#3363 Provide support for the SVS-VMANA index ([#​3385](redis/lettuce#3385)) by [@​tishun](https://github.com/tishun) in redis/lettuce#3386 ❤️ New Contributors## New Contributors - [@​hubertchylik](https://github.com/hubertchylik) made their first contribution in redis/lettuce#3366 **Full Changelog**: redis/lettuce@6.7.0.RELEASE...6.8.0.RELEASE </details> <details> <summary>square/wire (com.squareup.wire)</summary> ### [`v5.3.8`](https://github.com/square/wire/blob/HEAD/CHANGELOG.md#Version-538) [Compare Source](square/wire@5.3.7...5.3.8) *2025-08-08* ##### Swift - Fix edge case for oneof field named `self` ([#​3360](square/wire#3360) by \[Dimitris Koutsogiorgas]\[dnkoutso]) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 6pm every weekday,before 2am every weekday" in timezone Australia/Melbourne, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Never, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). GitOrigin-RevId: f26d0f3a5bf8e0f695433640efc9d6e93850ab60
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.
Redis CE 8.2 supports new operations often required with BITOP command;
DIFF(X, Y1, Y2, …)
members of X that are not members of any of Y1, Y2 ,…
X ∧ ¬(Y1 ∨ Y2 ∨ …)
DIFF1(X, Y1, Y2, …)
members of one or more of Y1, Y2 ,… that are not members of X
¬X ∧ (Y1 ∨ Y2 ∨ …)
ANDOR(X, Y1, Y2, …)
members of X that are also members of one or more of Y1, Y2 ,…
X ∧ (Y1 ∨ Y2 ∨ …)
ONE(X1, X2, …) -
members of exactly one of X1, X2, …
For two bitmaps this is equivalent to XOR(X1, X2) (AKA symmetric difference., X1 ⊕ X2). However, for more than two bitmaps, XOR has little practical use.
In general this is COUNT(X1, X2, …) == 1
See more details here.