-
Notifications
You must be signed in to change notification settings - Fork 639
feat: add index segment commit API #6209
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 all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2524ec8
feat: add index segment commit API
Xuanwo 260ab08
refactor: reuse dataset fragment bitmap
Xuanwo 1ee8aad
refactor: narrow index segment API
Xuanwo 9466b15
Merge branch 'main' into xuanwo/index-segment-commit-api
Xuanwo a66d616
build: update binding lockfiles
Xuanwo ea9b85c
Merge branch 'main' into xuanwo/index-segment-commit-api
Xuanwo 4b330de
refactor: encapsulate index segment construction
Xuanwo 575670b
style: fix python indices formatting
Xuanwo 98c707e
Merge branch 'main' into xuanwo/index-segment-commit-api
Xuanwo ecd23f0
refactor: tighten index segment follow-ups
Xuanwo a1a805f
refactor: require complete index segment metadata
Xuanwo aa6c77e
Merge remote-tracking branch 'origin/main' into xuanwo/index-segment-…
Xuanwo 4851fb6
refactor: require index segment commit support
Xuanwo 975c1f5
fix: remove unnecessary index version casts
Xuanwo 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,75 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // SPDX-FileCopyrightText: Copyright The Lance Authors | ||
|
|
||
| use std::sync::Arc; | ||
|
|
||
| use roaring::RoaringBitmap; | ||
| use uuid::Uuid; | ||
|
|
||
| /// A single physical segment of a logical index. | ||
| /// | ||
| /// Each segment is stored independently and will become one manifest entry when committed. | ||
| /// The logical index identity (name / target column / dataset version) is provided separately | ||
| /// by the commit API. | ||
| #[derive(Debug, Clone, PartialEq)] | ||
| pub struct IndexSegment { | ||
| /// Unique ID of the physical segment. | ||
| uuid: Uuid, | ||
| /// The fragments covered by this segment. | ||
| fragment_bitmap: RoaringBitmap, | ||
| /// Metadata specific to the index type. | ||
| index_details: Arc<prost_types::Any>, | ||
| /// The on-disk index version for this segment. | ||
| index_version: i32, | ||
| } | ||
|
|
||
| impl IndexSegment { | ||
| /// Create a fully described segment with the given UUID, fragment coverage, and index | ||
| /// metadata. | ||
| pub fn new<I>( | ||
| uuid: Uuid, | ||
| fragment_bitmap: I, | ||
| index_details: Arc<prost_types::Any>, | ||
| index_version: i32, | ||
| ) -> Self | ||
| where | ||
| I: IntoIterator<Item = u32>, | ||
| { | ||
| Self { | ||
| uuid, | ||
| fragment_bitmap: fragment_bitmap.into_iter().collect(), | ||
| index_details, | ||
| index_version, | ||
| } | ||
| } | ||
|
|
||
| /// Return the UUID of this segment. | ||
| pub fn uuid(&self) -> Uuid { | ||
| self.uuid | ||
| } | ||
|
|
||
| /// Return the fragment coverage of this segment. | ||
| pub fn fragment_bitmap(&self) -> &RoaringBitmap { | ||
| &self.fragment_bitmap | ||
| } | ||
|
|
||
| /// Return the serialized index details for this segment. | ||
| pub fn index_details(&self) -> &Arc<prost_types::Any> { | ||
| &self.index_details | ||
| } | ||
|
|
||
| /// Return the on-disk index version for this segment. | ||
| pub fn index_version(&self) -> i32 { | ||
| self.index_version | ||
| } | ||
|
|
||
| /// Consume the segment and return its component parts. | ||
| pub fn into_parts(self) -> (Uuid, RoaringBitmap, Arc<prost_types::Any>, i32) { | ||
| ( | ||
| self.uuid, | ||
| self.fragment_bitmap, | ||
| self.index_details, | ||
| self.index_version, | ||
| ) | ||
| } | ||
| } | ||
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
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.