Skip to content

Add COUNT aggregator support for ZINTER / ZINTERSTORE / ZUNION / ZUNIONSTORE (Redis 8.8) - #4506

Merged
uglide merged 8 commits into
redis:masterfrom
atakavci:ali/countAggregator
May 18, 2026
Merged

uglide merged 8 commits into
redis:masterfrom
atakavci:ali/countAggregator

Conversation

@atakavci

@atakavci atakavci commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Adds the new COUNT value to ZParams.Aggregate, enabling the AGGREGATE COUNT
option introduced in Redis 8.8 for the sorted-set commands; ZINTER / ZINTERSTORE / ZUNION / ZUNIONSTORE

For more info on the server change;
redis/redis#14892.
Reference issue: redis/redis#13955

Changes

  • src/main/java/redis/clients/jedis/params/ZParams.java
    Added COUNT to the Aggregate enum. Since the enum's raw bytes are derived
    from name() and aggregate() already emits the AGGREGATE keyword followed
    by the enum value, all four commands (zinter, zinterstore, zunion,
    zunionstore β€” both String and byte[] variants) automatically support
    the new aggregator with no further plumbing.

  • src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.java
    Added zunionInterAggregateCount, gated on Redis β‰₯ 8.7.225 (i.e. 8.8 RC),
    validating ZUNIONSTORE / ZINTERSTORE / ZUNION / ZINTER with
    AGGREGATE COUNT, both with and without explicit WEIGHTS. Mirrors the
    example from the feature spec.

  • src/test/java/redis/clients/jedis/commands/unified/cluster/ClusterSortedSetCommandsTest.java
    Cluster-mode override of the new test using hash-tagged keys ({:}),
    following the same pattern as the existing zinter / zinterstore /
    zintertoreParams overrides.

Compatibility

The new enum constant is purely additive; existing SUM / MIN / MAX usage
is unchanged. Sending AGGREGATE COUNT against a server older than 8.8 will
return 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.Aggregate enum constant and adds version-gated integration tests; behavior only changes when callers explicitly select COUNT on Redis 8.8+.

Overview
Adds COUNT to ZParams.Aggregate, enabling Jedis to emit AGGREGATE COUNT for ZINTER/ZINTERSTORE/ZUNION/ZUNIONSTORE.

Introduces new integration coverage (zunionInterAggregateCount) for both standalone and cluster modes, validating COUNT scoring semantics with and without WEIGHTS, gated to Redis >= 8.7.225 to avoid older-server failures.

Reviewed by Cursor Bugbot for commit 61fb5ce. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 COUNT to ZParams.Aggregate so ZParams.aggregate() can emit AGGREGATE COUNT.
  • Add a unified integration test covering AGGREGATE COUNT for 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 ggivo added this to the 8.0.0 milestone Apr 30, 2026
@uglide
uglide merged commit d002cf5 into redis:master May 18, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants