Skip to content
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

feat(spec): Add Snapshot #11

Merged
merged 3 commits into from
Jul 9, 2024
Merged

feat(spec): Add Snapshot #11

merged 3 commits into from
Jul 9, 2024

Conversation

QuakeWang
Copy link
Contributor

fix: #6

This PR will add Snapshot. Some function include ManifestList is not implemented yet.

///
/// Impl Reference: <https://github.com/apache/paimon/blob/db8bcd7fdd9c2705435d2ab1d2341c52d1f67ee5/paimon-core/src/main/java/org/apache/paimon/Snapshot.java#L68>.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, TypedBuilder)]
pub struct Snapshot {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we need serde(rename_all("camelCase"))?

delta_manifest_list: String,
/// a manifest list recording all changelog produced in this snapshot
#[builder(default = None)]
change_log_manifest_list: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be changelog_manifest_list

delta_record_count: Option<i64>,
/// record count of all changelog produced in this snapshot
#[builder(default = None)]
change_log_record_count: Option<i64>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be changelog_record_count

}

#[inline]
pub fn change_log_manifest_list(&self) -> Option<&String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to return Option<&str> instead.

}

#[inline]
pub fn commit_kind(&self) -> &CommitKind {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CommitKind could be Copy, we can return CommitKind directly.


impl Snapshot {
#[inline]
pub fn version(&self) -> i32 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to provide APIs for our public API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to provide APIs for our public API.

Do you mean remove #[inline]?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I mean add API docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I mean add API docs.

I have updated it, PTAL 👀

// specific language governing permissions and limitations
// under the License.

/*!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use //! for mod docs.

commit_identifier: i64,
commit_kind: CommitKind,
time_millis: i64,
log_offsets: HashMap<i32, i64>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need to add this field.
We don't write it, and we don't have requirement to read it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need to add this field. We don't write it, and we don't have requirement to read it.

OK, I will remove it later.

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, let's move!

@Xuanwo
Copy link
Member

Xuanwo commented Jul 9, 2024

cc @JingsongLi and @SteNicholas for another look.

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@JingsongLi JingsongLi merged commit 975b1aa into apache:main Jul 9, 2024
@QuakeWang QuakeWang deleted the add-snapshot branch July 9, 2024 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spec: Implement Snapshot
3 participants