-
Notifications
You must be signed in to change notification settings - Fork 421
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: typed commit info #1207
feat: typed commit info #1207
Conversation
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.
This looks like a good improvement. It seems unfortunate the format of commitInfo isn't standardized in the protocol.
rust/src/action/mod.rs
Outdated
/// Version number the commit corresponds to | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub version: Option<DeltaDataTypeVersion>, |
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.
Isn't this redundant?
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.
It is, and nobody actually writes it to the commit info in the log. Initially I was following the spark implementation for the optimistic commits quite closely, where this field is being used. Not sure if we still do though. I'll remove it for now, and bring it back in case its needed in the follow up PR...
pub version: Option<DeltaDataTypeVersion>, | ||
/// Timestamp in millis when the commit was created | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub timestamp: Option<DeltaDataTypeTimestamp>, |
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.
As an aside, it would be cool if we swapped out DeltaDataTypeTimestamp
for a type whose Debug
/ Display
implementation is a formatted timestamp rather than an integer.
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.
Absolutely, we may also be able to implement custom serde, so it is parsed as a datetime.
rust/src/operations/transaction.rs
Outdated
pub(crate) async fn prepare_commit( | ||
storage: &dyn ObjectStore, | ||
operation: &DeltaOperation, | ||
actions: &mut Vec<Action>, |
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.
Why is this changed to a &mut
instead of just an owned value?
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 extracted this from the optimistic commit PR where we are using this in a loop and need access to the actions afterwards. That said, having this mutable in that scenario is likely not the best idea, and we need it only to add the commit info. Changed is so we just take a borrowed value now.
# Description Another PR on the road to delta-io#632 - ~~keeping it a draft, as it is based on delta-io#1206~~ While the `commitInfo` action is defined as completely optional, spark and delta-rs write at the very least interesting, but often also quite helpful information into the commit info. To make it easier to work with and centralize some conventions, we introduce a `CommitInfo` struct, that exposes some of the fields at the top level. Additionally we harmonize a bit between spark and delta-rs conventions. # Related Issue(s) part of delta-io#632 # Documentation <!--- Share links to useful documentation ---> --------- Co-authored-by: Will Jones <[email protected]>
Description
Another PR on the road to #632 -
keeping it a draft, as it is based on #1206While the
commitInfo
action is defined as completely optional, spark and delta-rs write at the very least interesting, but often also quite helpful information into the commit info. To make it easier to work with and centralize some conventions, we introduce aCommitInfo
struct, that exposes some of the fields at the top level. Additionally we harmonize a bit between spark and delta-rs conventions.Related Issue(s)
part of #632
Documentation