Skip to content

Filter deferred points: retrieve - #8315

Merged
JojiiOfficial merged 2 commits into
devfrom
filter-deferred-points-retrieve
Mar 11, 2026
Merged

JojiiOfficial merged 2 commits into
devfrom
filter-deferred-points-retrieve

Conversation

@JojiiOfficial

@JojiiOfficial JojiiOfficial commented Mar 6, 2026 •

Copy link
Copy Markdown
Member

Depends on #8299

Implements filtering of deferred points from retrieve operations.

Todo:

  • Implementation
  • Tests

@JojiiOfficial
JojiiOfficial changed the base branch from master to filter-deferred-points-sparse-search March 6, 2026 16:48
@JojiiOfficial
JojiiOfficial force-pushed the filter-deferred-points-retrieve branch from fecbbfb to a7cd1e5 Compare March 6, 2026 16:53
@JojiiOfficial JojiiOfficial added this to the deferred updates milestone Mar 6, 2026
@JojiiOfficial JojiiOfficial mentioned this pull request Mar 9, 2026
2 tasks done
@JojiiOfficial
JojiiOfficial marked this pull request as ready for review March 10, 2026 09:26
@JojiiOfficial
JojiiOfficial force-pushed the filter-deferred-points-sparse-search branch from 13eeb9e to 8bfe14a Compare March 10, 2026 14:09
@JojiiOfficial
JojiiOfficial force-pushed the filter-deferred-points-retrieve branch from 17c9b8f to 985d964 Compare March 10, 2026 14:17
@IvanPleshkov
IvanPleshkov self-requested a review March 10, 2026 15:29

@IvanPleshkov IvanPleshkov 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.

Easy-peasy!
I would like to discuss later whether we need to filter deferred points in Segment::read_vectors. But I find it out of scope and a useless time spent

@timvisee

Copy link
Copy Markdown
Member

Imo filtering deferred should be optional as described here: #8310 (review)

But we can probably handle it in that PR.

@JojiiOfficial
JojiiOfficial force-pushed the filter-deferred-points-sparse-search branch from 8bfe14a to ac5706a Compare March 11, 2026 08:22
@JojiiOfficial
JojiiOfficial force-pushed the filter-deferred-points-retrieve branch from 985d964 to 4361791 Compare March 11, 2026 08:23
Base automatically changed from filter-deferred-points-sparse-search to dev March 11, 2026 09:09
@JojiiOfficial
JojiiOfficial force-pushed the filter-deferred-points-retrieve branch from 4361791 to 8aa0995 Compare March 11, 2026 09:11
@coderabbitai

coderabbitai Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This change implements a two-stage filtering mechanism in the retrieve operation to exclude deferred points when reading vector and payload data. The implementation adds conditional logic that filters out deferred point IDs before data retrieval. The test suite is extended with a new parameter to enable testing both filtered and non-filtered retrieval scenarios, and new test cases for the Retrieve API are added to validate deferred point exclusion behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested reviewers

  • agourlay
  • IvanPleshkov
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Filter deferred points: retrieve' clearly and specifically describes the main change: implementing deferred point filtering for retrieve operations.
Description check ✅ Passed The description is directly related to the changeset, explaining that it implements filtering of deferred points from retrieve operations with completed implementation and tests.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch filter-deferred-points-retrieve

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
lib/segment/src/segment/tests.rs (1)

969-970: Keep N_POINTS single-sourced.

There is still another const N_POINTS inside assert_deferred_points_excluded at Line 1187, so these tests can drift independently. Reusing the module constant here would avoid that split.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/segment/src/segment/tests.rs` around lines 969 - 970, The file defines a
duplicate constant N_POINTS; replace the local constant used inside
assert_deferred_points_excluded with the module-level const N_POINTS so the
tests share a single source of truth: in the function
assert_deferred_points_excluded, remove or stop declaring a new const N_POINTS
and reference the existing module-level N_POINTS constant instead to prevent
drift between the two definitions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lib/segment/src/segment/tests.rs`:
- Around line 1073-1075: The test builds point_ids from a dense range
(1..=segment.available_point_count()) which assumes numeric dense IDs; instead
collect the actual IDs present in the segment and use those in the retrieve()
call. Replace the range construction with a collection from the segment's
point-id iterator (e.g. use segment.iter_point_ids() or segment.point_ids() /
point_id_iter() depending on the API) and map each returned id into
ExtendedPointId (rather than creating ExtendedPointId::NumId from the index), so
the request uses the real deferred point IDs created by create_deferred_segment
when calling segment.retrieve().

---

Nitpick comments:
In `@lib/segment/src/segment/tests.rs`:
- Around line 969-970: The file defines a duplicate constant N_POINTS; replace
the local constant used inside assert_deferred_points_excluded with the
module-level const N_POINTS so the tests share a single source of truth: in the
function assert_deferred_points_excluded, remove or stop declaring a new const
N_POINTS and reference the existing module-level N_POINTS constant instead to
prevent drift between the two definitions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: abd6cb5f-534a-408a-82d2-6f062b995b0f

📥 Commits

Reviewing files that changed from the base of the PR and between e38d3d6 and 8aa0995.

📒 Files selected for processing (2)
  • lib/segment/src/segment/entry.rs
  • lib/segment/src/segment/tests.rs

Comment on lines +1073 to +1075
let point_ids: Vec<_> = (1..=segment.available_point_count())
.map(|i| ExtendedPointId::NumId(i as u64))
.collect();

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.

⚠️ Potential issue | 🟡 Minor

Build the retrieve request from actual point IDs, not a dense 1..=count range.

This only works because create_deferred_segment currently inserts dense numeric IDs. With WithVector::Bool(false), retrieve() returns records for the requested IDs themselves, so a future sparse-ID fixture could still pass here without ever requesting the real deferred points.

🔧 Suggested fix
-            let point_ids: Vec<_> = (1..=segment.available_point_count())
-                .map(|i| ExtendedPointId::NumId(i as u64))
-                .collect();
+            let point_ids: Vec<_> = segment.iter_points().collect();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/segment/src/segment/tests.rs` around lines 1073 - 1075, The test builds
point_ids from a dense range (1..=segment.available_point_count()) which assumes
numeric dense IDs; instead collect the actual IDs present in the segment and use
those in the retrieve() call. Replace the range construction with a collection
from the segment's point-id iterator (e.g. use segment.iter_point_ids() or
segment.point_ids() / point_id_iter() depending on the API) and map each
returned id into ExtendedPointId (rather than creating ExtendedPointId::NumId
from the index), so the request uses the real deferred point IDs created by
create_deferred_segment when calling segment.retrieve().

@JojiiOfficial

Copy link
Copy Markdown
Member Author

But we can probably handle it in that PR.

It's implemented in that PR now: 9c3e181

@JojiiOfficial
JojiiOfficial merged commit 4c10365 into dev Mar 11, 2026
16 checks passed
@JojiiOfficial
JojiiOfficial deleted the filter-deferred-points-retrieve branch March 11, 2026 10:35
generall pushed a commit that referenced this pull request Mar 26, 2026
* Filter deferred points: Retrieve

* Add tests
KShivendu pushed a commit that referenced this pull request Mar 30, 2026
* Filter deferred points: Retrieve

* Add tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants