Visitar URL original
Add new COLLECT parameter for FT.AGGREGATE by uglide · Pull Request #4534 · redis/jedis · GitHub
Skip to content

Add new COLLECT parameter for FT.AGGREGATE - #4534

Merged
uglide merged 4 commits into
masterfrom
im/ft-aggregate-collect
May 22, 2026
Merged

uglide merged 4 commits into
masterfrom
im/ft-aggregate-collect

Conversation

@uglide

@uglide uglide commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

Adds native client support for the new REDUCE COLLECT reducer introduced in Redis Search 8.7.225, which gathers per-document projections within a GROUPBY group. The reducer follows the grammar

REDUCE COLLECT <narg>
    FIELDS ( * | <num_fields> <field_1> [<field_2> ...] )
    [SORTBY <narg> <@field> [ASC|DESC] [<@field> [ASC|DESC] ...]]
    [LIMIT <offset> <count>]
  [AS <alias>]

narg counts every token between COLLECT and the optional AS,
FIELDS is mutually exclusive between * (expands to all fields in the current row) and an explicit count + list, and the optional SORTBY/LIMIT tuples produce a top-K projection per group.


Note

Low Risk
Additive, experimental aggregation-builder support plus new tests; low blast radius, with main risk being incorrect argument serialization (narg/FIELD/SORTBY/LIMIT ordering) causing query failures on supported Redis Search versions.

Overview
Adds native client support for Redis Search’s experimental FT.AGGREGATE ... REDUCE COLLECT via a new CollectReducer builder (Reducers.collect()), supporting FIELDS (explicit list or *), optional SORTBY, and optional LIMIT, with validation to prevent invalid combinations and to enforce required FIELDS configuration.

Introduces unit tests to lock down exact token/narg serialization, plus new standalone and cluster integration tests (RESP2/RESP3) that enable the server-side search-enable-unstable-features flag and verify COLLECT behavior (top-K, FIELDS *, sparse fields, and deterministic tie-breaking), along with a small SearchFeatureFlags test utility for toggling/verifying that flag.

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

@github-actions

github-actions Bot commented May 21, 2026 •

Copy link
Copy Markdown

Test Results

  199 files  + 2    199 suites  +2   9m 14s ⏱️ -21s
7 351 tests +20  7 108 ✅ +127  243 💤  - 107  0 ❌ ±0 
7 371 runs  +20  7 128 ✅ +129  243 💤  - 109  0 ❌ ±0 

Results for commit 238391f. ± Comparison against base commit c2cd9dd.

♻️ This comment has been updated with latest results.

@uglide
uglide force-pushed the im/ft-aggregate-collect branch from 11540b9 to b260a5d Compare May 21, 2026 09:00
@jit-ci

jit-ci Bot commented May 21, 2026 •

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@uglide
uglide marked this pull request as ready for review May 22, 2026 09:08
@uglide
uglide requested a review from ggivo May 22, 2026 13:06

@ggivo ggivo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@uglide
uglide merged commit 07f4636 into master May 22, 2026
18 checks passed
@uglide
uglide deleted the im/ft-aggregate-collect branch May 22, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants