Repository navigation
Add COUNT aggregator support for ZINTER / ZINTERSTORE / ZUNION / ZUNIONSTORE (Redis 8.8) - #4506
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support in Jedis for Redis 8.8βs AGGREGATE COUNT option for sorted-set set-operations (ZINTER, ZINTERSTORE, ZUNION, ZUNIONSTORE) by extending ZParams.Aggregate and adding integration tests validating the new behavior.
Changes:
- Add
COUNTtoZParams.AggregatesoZParams.aggregate()can emitAGGREGATE COUNT. - Add a unified integration test covering
AGGREGATE COUNTfor store + non-store variants (cluster + non-cluster), including a WEIGHTS scenario. - Add a cluster override of the new test using hash-tagged keys to ensure same-slot execution.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/main/java/redis/clients/jedis/params/ZParams.java |
Extends the Aggregate enum with COUNT so the existing argument emission supports Redis 8.8. |
src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.java |
Adds a new integration test for AGGREGATE COUNT, gated to Redis β₯ 8.7.225. |
src/test/java/redis/clients/jedis/commands/unified/cluster/ClusterSortedSetCommandsTest.java |
Overrides the new test with same-hashslot keys for cluster mode. |
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ggivo
approved these changes
Apr 30, 2026
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.
Adds the new
COUNTvalue toZParams.Aggregate, enabling theAGGREGATE COUNToption introduced in Redis 8.8 for the sorted-set commands;
ZINTER/ZINTERSTORE/ZUNION/ZUNIONSTOREFor more info on the server change;
redis/redis#14892.
Reference issue: redis/redis#13955
Changes
src/main/java/redis/clients/jedis/params/ZParams.javaAdded
COUNTto theAggregateenum. Since the enum's raw bytes are derivedfrom
name()andaggregate()already emits theAGGREGATEkeyword followedby the enum value, all four commands (
zinter,zinterstore,zunion,zunionstoreβ bothStringandbyte[]variants) automatically supportthe new aggregator with no further plumbing.
src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.javaAdded
zunionInterAggregateCount, gated on Redis β₯ 8.7.225 (i.e. 8.8 RC),validating
ZUNIONSTORE/ZINTERSTORE/ZUNION/ZINTERwithAGGREGATE COUNT, both with and without explicitWEIGHTS. Mirrors theexample from the feature spec.
src/test/java/redis/clients/jedis/commands/unified/cluster/ClusterSortedSetCommandsTest.javaCluster-mode override of the new test using hash-tagged keys (
{:}),following the same pattern as the existing
zinter/zinterstore/zintertoreParamsoverrides.Compatibility
The new enum constant is purely additive; existing
SUM/MIN/MAXusageis unchanged. Sending
AGGREGATE COUNTagainst a server older than 8.8 willreturn a server-side error, so the integration tests are gated with
@SinceRedisVersion("8.7.225")and will be skipped on older Redis versions.Note
Low Risk
Low risk additive change: introduces a new
ZParams.Aggregateenum constant and adds version-gated integration tests; behavior only changes when callers explicitly selectCOUNTon Redis 8.8+.Overview
Adds
COUNTtoZParams.Aggregate, enabling Jedis to emitAGGREGATE COUNTforZINTER/ZINTERSTORE/ZUNION/ZUNIONSTORE.Introduces new integration coverage (
zunionInterAggregateCount) for both standalone and cluster modes, validatingCOUNTscoring semantics with and withoutWEIGHTS, gated to Redis>= 8.7.225to avoid older-server failures.Reviewed by Cursor Bugbot for commit 61fb5ce. Bugbot is set up for automated code reviews on this repo. Configure here.