-
Notifications
You must be signed in to change notification settings - Fork 60
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!: add in-commit timestamps table properties #558
feat!: add in-commit timestamps table properties #558
Conversation
Mention: #559 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #558 +/- ##
==========================================
+ Coverage 84.08% 84.09% +0.01%
==========================================
Files 77 77
Lines 17777 17805 +28
Branches 17777 17805 +28
==========================================
+ Hits 14948 14974 +26
Misses 2115 2115
- Partials 714 716 +2 ☔ View full report in Codecov by Sentry. |
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.
Besides that one nit, I think it looks good 👍
props.enable_in_commit_timestamps = Some(parse_bool(v)?) | ||
} | ||
"delta.inCommitTimestampEnablementVersion" => { | ||
props.in_commit_timestamp_enablement_version = Some(parse_uint(v)?) |
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.
parse_uint
already returns an option. Why not just:
props.in_commit_timestamp_enablement_version = Some(parse_uint(v)?) | |
props.in_commit_timestamp_enablement_version = parse_uint(v) |
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.
ah i actually had to think about this for a sec too lol - we actually want to return None
in the case it doesn't parse. if we leave it as just parse_uint(v)
then it will set the value to None
and return Some
perhaps we should rethink this code and try to rewrite it more nicely considering both you and I have now stumbled on it :)
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.
Ah you're right! Thx for the clarification
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 also took a solid minute to grok, does the class/method have a doc comment explaining the intended behavior?
Basically, we want the entire method to return None if a required property fails to parse (indicating failure) -- not merely set that property to None (it was probably None already)?
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.
yep exactly. added a comment to clarify but given this has tripped up three of us now I think we should rewrite lol
made a quick issue: #682
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.
LGTM!
props.enable_in_commit_timestamps = Some(parse_bool(v)?) | ||
} | ||
"delta.inCommitTimestampEnablementVersion" => { | ||
props.in_commit_timestamp_enablement_version = Some(parse_uint(v)?) |
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 also took a solid minute to grok, does the class/method have a doc comment explaining the intended behavior?
Basically, we want the entire method to return None if a required property fails to parse (indicating failure) -- not merely set that property to None (it was probably None already)?
assert_eq!(parse_non_negative::<u64>("12").unwrap(), 12); | ||
assert_eq!(parse_non_negative::<u64>("0").unwrap(), 0); | ||
assert_eq!(parse_non_negative::<u64>("-12"), None); | ||
assert_eq!(parse_non_negative::<i64>("12").unwrap(), 12); |
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.
post-hoc nit:
assert_eq!(parse_non_negative("12").unwrap(), 12_i64);
(make type inference work for you)
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.
ah thanks!
What changes are proposed in this pull request?
Parse:
delta.enableInCommitTimestamps
,delta.inCommitTimestampEnablementVersion
, anddelta.inCommitTimestampEnablementTimestamp
and expose table property methods to access.This PR affects the following public APIs
New pub fields in
TableProperties
:enable_in_commit_timestamps
in_commit_timestamp_enablement_version
in_commit_timestamp_enablement_timestamp
How was this change tested?
new UT