Repository navigation
feat: add readonly bool - #9030
Conversation
📝 WalkthroughWalkthroughThis PR integrates Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
🧹 Nitpick comments (1)
lib/segment/src/index/field_index/field_index_base/read_only/read_ops.rs (1)
21-199: ⚡ Quick winAdd focused coverage for the new read-only bool dispatch paths.
This wiring touches many match-based entry points; adding targeted tests for
ReadOnlyFieldIndex::BoolIndex(includingas_facet_index→FacetIndexEnum::BoolReadOnly) will harden against future variant drift.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/segment/src/index/field_index/field_index_base/read_only/read_ops.rs` around lines 21 - 199, Add focused unit tests that exercise the ReadOnlyFieldIndex::BoolIndex variant across all dispatch points to prevent regression: create a ReadOnlyFieldIndex::BoolIndex instance and assert behavior for count_indexed_points(), filter(...), estimate_cardinality(...), for_each_payload_block(...), condition_checker(...), special_check_condition(...), get_telemetry_data(), values_count()/values_is_empty(), value_retriever(...), as_numeric() returning None, and as_facet_index() returning a FacetIndexEnum::BoolReadOnly; use the exact enums and methods named (ReadOnlyFieldIndex, BoolIndex, FacetIndexEnum::BoolReadOnly, MapIndexRead/BoolIndexRead/NullIndexRead helpers where relevant) so the tests hit each match arm shown in the impl and fail if future variant dispatch breaks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@lib/segment/src/index/field_index/field_index_base/read_only/read_ops.rs`:
- Around line 21-199: Add focused unit tests that exercise the
ReadOnlyFieldIndex::BoolIndex variant across all dispatch points to prevent
regression: create a ReadOnlyFieldIndex::BoolIndex instance and assert behavior
for count_indexed_points(), filter(...), estimate_cardinality(...),
for_each_payload_block(...), condition_checker(...),
special_check_condition(...), get_telemetry_data(),
values_count()/values_is_empty(), value_retriever(...), as_numeric() returning
None, and as_facet_index() returning a FacetIndexEnum::BoolReadOnly; use the
exact enums and methods named (ReadOnlyFieldIndex, BoolIndex,
FacetIndexEnum::BoolReadOnly, MapIndexRead/BoolIndexRead/NullIndexRead helpers
where relevant) so the tests hit each match arm shown in the impl and fail if
future variant dispatch breaks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a57d9fda-6212-4c75-a003-89e041c9746c
📒 Files selected for processing (5)
lib/segment/src/index/field_index/bool_index/mod.rslib/segment/src/index/field_index/bool_index/read_ops.rslib/segment/src/index/field_index/facet_index.rslib/segment/src/index/field_index/field_index_base/read_only/mod.rslib/segment/src/index/field_index/field_index_base/read_only/read_ops.rs
All Submissions:
devbranch (notmaster) and my branch was created fromdev.New Feature Submissions:
cargo +nightly fmt --allcommand prior to submission?cargo clippy --workspace --all-featurescommand?Changes to Core Features: