Refactor Optional Iterator Optimized mode - [MOD-9678]#6352
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6352 +/- ##
==========================================
+ Coverage 88.84% 88.89% +0.04%
==========================================
Files 247 247
Lines 41213 41340 +127
Branches 3483 3483
==========================================
+ Hits 36617 36749 +132
+ Misses 4553 4548 -5
Partials 43 43
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:
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the optional iterator implementation to support an optimized mode and updates its API by switching to a QueryEvalCtx parameter. Key changes include:
- Updating the NewOptionalIterator API in both production and test code to pass a query context instead of discrete maxDocId/numDocs values.
- Adding new tests and benchmark cases for the optimized iterator behavior, and adjusting expected values in timeout scenarios.
- Minor fixes in the benchmark and auxiliary index utilities to support the refactoring.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/cpptests/test_cpp_iterator_optional.cpp | Updated tests to pass QueryEvalCtx and revised expected behavior, e.g. lastDocId after timeout. |
| tests/cpptests/micro-benchmarks/benchmark_optional_iterator.cpp | Adjusted benchmark parameters and initialization based on the new optimized flag. |
| tests/cpptests/index_utils.h | Modified MockQueryEvalCtx constructor to optionally accept a document vector. |
| src/iterators/optional_iterator.h | Updated the NewOptionalIterator API to accept a QueryEvalCtx and added a wildcard iterator field. |
| src/iterators/optional_iterator.c | Refactored Read and SkipTo functions to incorporate the optimized behavior using the wildcard iterator. |
Comments suppressed due to low confidence (1)
src/iterators/optional_iterator.h:22
- [nitpick] The variable name 'wcii' is ambiguous; consider renaming it to 'wildcardIterator' for improved clarity.
QueryIterator *wcii; // wildcard child iterator, used for optimization
JoanFM
reviewed
Jun 23, 2025
JoanFM
approved these changes
Jun 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the changes in the pull request
Implement the optimized variant of the optional iterator
Main objects this PR modified
Mark if applicable