MOD-10798: Support K Ratio argument in FT.HYBRID vector query#8227
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8227 +/- ##
==========================================
- Coverage 83.00% 82.89% -0.11%
==========================================
Files 389 414 +25
Lines 57556 58815 +1259
Branches 15708 16873 +1165
==========================================
+ Hits 47772 48757 +985
- Misses 9625 9877 +252
- Partials 159 181 +22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Itzikvaknin
left a comment
There was a problem hiding this comment.
Looks good, left a few comments
cd40a7a to
549bd2b
Compare
| if (parseYieldScoreClause(ac, pvd, status) != REDISMODULE_OK) { | ||
| goto error; | ||
| // Check for optional YIELD_SCORE_AS detecting duplicate arguments | ||
| while (!AC_IsAtEnd(ac)) { |
There was a problem hiding this comment.
Is this while loop required?
There was a problem hiding this comment.
It detects duplicate YIELD_SCORE_AS, in this example:
...
"SEARCH", "hello",
"VSIM", "@vector", "$BLOB",
"KNN", "2", "K", "10",
"YIELD_SCORE_AS", "dist1", "YIELD_SCORE_AS", "dist2",
...Without the loop, the error is reported as: "YIELD_SCORE_AS: Unknown argument"
With the loop: "Duplicate YIELD_SCORE_AS argument"
Itzikvaknin
left a comment
There was a problem hiding this comment.
a few minor comments
|
|
/backport |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 8.4
git worktree add -d .worktree/backport-8227-to-8.4 origin/8.4
cd .worktree/backport-8227-to-8.4
git switch --create backport-8227-to-8.4
git cherry-pick -x d7ac7d333dfa3824f925094ad585c65560294dd4 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 8.6
git worktree add -d .worktree/backport-8227-to-8.6 origin/8.6
cd .worktree/backport-8227-to-8.6
git switch --create backport-8227-to-8.6
git cherry-pick -x d7ac7d333dfa3824f925094ad585c65560294dd4 |
(cherry picked from commit d7ac7d3)
…tor query (#8400) * [8.4] MOD-14094, MOD-10798: Support K Ratio argument in FT.HYBRID vector query (#8227) (cherry picked from commit d7ac7d3) * Fix "since" field in commands.json Co-authored-by: Omer Shadmi <[email protected]> * Update "since" field for SHARD_K_RATIO in FT.HYBRID command to 8.4.7 --------- Co-authored-by: Omer Shadmi <[email protected]>



Describe the changes in the pull request
Support K Ratio argument in FT.HYBRID vector query, as part of KNN clause.
Main objects this PR modified
Mark if applicable
Release Notes
Note
Medium Risk
Touches hybrid parsing and distributed command construction, which can affect query correctness/performance in clustered execution. Risk is mitigated by explicit validation and extensive new unit/integration tests.
Overview
Adds support for the new optional
SHARD_K_RATIOargument (since 8.6.1) inFT.HYBRIDKNN queries, allowing distributed executions to request fewer candidates per shard (while still guaranteeing enough results overall).The coordinator now computes an effective per-shard K from the ratio and shard count, rewrites the distributed VSIM KNN
Kvalue accordingly, and makes shard-count access thread-safe by capturing it in the concurrent command context. Validation and duplicate detection forSHARD_K_RATIO(and improved duplicate handling forYIELD_SCORE_AS) are added, with expanded C++ and new Python tests covering parsing, error cases, and cluster profile behavior.Written by Cursor Bugbot for commit 3436088. This will update automatically on new commits. Configure here.