Repository navigation
Filter deferred points: retrieve - #8315
Conversation
fecbbfb to
a7cd1e5
Compare
13eeb9e to
8bfe14a
Compare
17c9b8f to
985d964
Compare
IvanPleshkov
left a comment
There was a problem hiding this comment.
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
|
Imo filtering deferred should be optional as described here: #8310 (review) But we can probably handle it in that PR. |
8bfe14a to
ac5706a
Compare
985d964 to
4361791
Compare
4361791 to
8aa0995
Compare
📝 WalkthroughWalkthroughThis 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
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
lib/segment/src/segment/tests.rs (1)
969-970: KeepN_POINTSsingle-sourced.There is still another
const N_POINTSinsideassert_deferred_points_excludedat 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
📒 Files selected for processing (2)
lib/segment/src/segment/entry.rslib/segment/src/segment/tests.rs
| let point_ids: Vec<_> = (1..=segment.available_point_count()) | ||
| .map(|i| ExtendedPointId::NumId(i as u64)) | ||
| .collect(); |
There was a problem hiding this comment.
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().
It's implemented in that PR now: 9c3e181 |
* Filter deferred points: Retrieve * Add tests
* Filter deferred points: Retrieve * Add tests
Depends on #8299
Implements filtering of deferred points from retrieve operations.
Todo: