-
Notifications
You must be signed in to change notification settings - Fork 34
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
spec: Add missing property in Snapshot #41
Closed
Closed
Changes from all commits
Commits
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 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 |
---|---|---|
|
@@ -39,6 +39,16 @@ pub struct Snapshot { | |
#[builder(default = None)] | ||
index_manifest: Option<String>, | ||
commit_user: String, | ||
// Mainly for snapshot deduplication. | ||
// | ||
// If multiple snapshots have the same commitIdentifier, reading from any of these snapshots | ||
// must produce the same table. | ||
// | ||
// If snapshot A has a smaller commitIdentifier than snapshot B, then snapshot A must be | ||
// committed before snapshot B, and thus snapshot A must contain older records than snapshot B. | ||
commit_identifier: i64, | ||
commit_kind: CommitKind, | ||
time_millis: u64, | ||
/// record count of all changes occurred in this snapshot | ||
#[builder(default = None)] | ||
total_record_count: Option<i64>, | ||
|
@@ -134,4 +144,38 @@ impl Snapshot { | |
pub fn statistics(&self) -> Option<&str> { | ||
self.statistics.as_deref() | ||
} | ||
|
||
/// Get the commit time of this snapshot. | ||
#[inline] | ||
pub fn time_millis(&self) -> u64 { | ||
self.time_millis | ||
} | ||
|
||
/// Get the commit identifier of this snapshot. | ||
#[inline] | ||
pub fn commit_identifier(&self) -> i64 { | ||
self.commit_identifier | ||
} | ||
|
||
/// Get the commit kind of this snapshot. | ||
#[inline] | ||
pub fn commit_kind(&self) -> CommitKind { | ||
self.commit_kind | ||
} | ||
} | ||
|
||
/// Type of changes in this snapshot. | ||
/// | ||
/// Impl Reference: <https://github.com/apache/paimon/blob/release-0.8.2/paimon-core/src/main/java/org/apache/paimon/Snapshot.java#L506>. | ||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub enum CommitKind { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @QuakeWang I think that just means |
||
/// Change flushed from the mem table. | ||
Append, | ||
/// Changes by compacting existing data files. | ||
Compact, | ||
/// Changes that clear up the whole partition and then add new records. | ||
Overwrite, | ||
/// Collect statistics. | ||
Analyze, | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question out of this PR. Currently, the overwrite (expire partition) share the same commit identifier with the current snapshots's commit identifier. So I think this comments may not right ? CC @JingsongLi