MB-70770: Optimize a few APIs in hierarchy search#430
Merged
Conversation
Likith101
previously approved these changes
Jun 26, 2026
maneuvertomars
previously approved these changes
Jun 26, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes nested/hierarchy-related operations in the zap segment implementation by replacing callback-based bitmap iteration, adding precomputed descendant lookups, and making edge-list APIs internal-only.
Changes:
- Refactors
CountRoot()to use internal helpers and an iterator-based root-deleted counter. - Reworks
AddNestedDocuments()to union precomputed descendant bitmaps instead of repeatedly scanning the edge list. - Un-exports edge list APIs and updates merge/test code accordingly.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| segment.go | Refactors root counting and descendant expansion; introduces internal edgeList()/descendantStore() helpers. |
| nested_cache.go | Builds a descendant store during cache initialization; un-exports edge list types/methods; iterator-based root-deleted counting. |
| merge.go | Updates merge logic to use un-exported edge list APIs. |
| nested_test.go | Updates tests to use un-exported edge list APIs and methods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1bfe82c
Likith101
approved these changes
Jun 26, 2026
maneuvertomars
approved these changes
Jun 26, 2026
CascadingRadium
added a commit
that referenced
this pull request
Jun 26, 2026
- Optimize `countRoot` to use bitmap iterator instead of bitmap.Iterate(), avoiding callback overhead. - Optimize `AddNestedDocuments` to take advantage of the monotonic, preorder nature of document numbers of the root and child documents in the segment to avoid repeatedly scanning the entire edge list multiple times. - Un-export all edge list methods as they are for internal use only.
CascadingRadium
added a commit
that referenced
this pull request
Jun 26, 2026
- Back port #430 to this branch
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.
countRootto use bitmap iterator instead of bitmap.Iterate(), avoiding callback overhead.AddNestedDocumentsto take advantage of the monotonic, preorder nature of document numbers of the root and child documents in the segment to avoid repeatedly scanning the entire edge list multiple times.