Repository navigation
feat: batching execution (single iterator queries) #390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
52bc2fa
new batching flow (currently only of single-iterator queries)
cheb0 3a13fa7
max 4096 to batch on one-by-one flow
cheb0 f338fab
unused function
cheb0 421f574
Merge branch 'main' into 329-batching-1
cheb0 da8604a
larger lid buf
cheb0 eae1396
Merge branch 'main' into 329-batching-1
cheb0 c578f6c
Merge branch 'main' into 329-batching-1
cheb0 e9a6a9b
review fixes
cheb0 cc4076d
Merge remote-tracking branch 'origin/329-batching-1' into 329-batching-1
cheb0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package node | ||
|
|
||
| import ( | ||
| "slices" | ||
| ) | ||
|
|
||
| // LIDBatch represents a batch of LIDs. lids are stored as uint32 slice and sorted in ascending order regardless of doc order. | ||
| // This allows to avoid copying and use reference to LID blocks data. | ||
| // Such batches are also logically immutable - we can't append or delete from them, only union or intersect. But we can zero out (reset) them. | ||
| type LIDBatch struct { | ||
| lids []uint32 | ||
| desc bool // if doc order is DESC (default order) | ||
| } | ||
|
|
||
| // NewDescBatch creates a batch of lids for DESC docs order | ||
| func NewDescBatch(lids []uint32) LIDBatch { | ||
| return LIDBatch{ | ||
| lids: lids, | ||
| desc: true, | ||
| } | ||
| } | ||
|
|
||
| // NewAscBatch creates a batch of lids for ASC docs order | ||
| func NewAscBatch(lids []uint32) LIDBatch { | ||
| return LIDBatch{ | ||
| lids: lids, | ||
| desc: false, | ||
| } | ||
| } | ||
|
|
||
| func (b LIDBatch) Len() int { | ||
| return len(b.lids) | ||
| } | ||
|
|
||
| func (b LIDBatch) Lids(out []LID) []LID { | ||
| if b.desc { | ||
| for _, lid := range b.lids { | ||
| out = append(out, NewDescLID(lid)) | ||
| } | ||
| } else { | ||
| for _, lid := range slices.Backward(b.lids) { | ||
| out = append(out, NewAscLID(lid)) | ||
| } | ||
| } | ||
|
|
||
| return out | ||
| } | ||
|
|
||
| func (b LIDBatch) Reset() LIDBatch { | ||
| return LIDBatch{ | ||
| lids: b.lids[:0], | ||
| desc: b.desc, | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.