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!: add in-commit timestamps table properties #558

Merged
merged 8 commits into from
Feb 6, 2025

Conversation

zachschuermann
Copy link
Collaborator

@zachschuermann zachschuermann commented Dec 4, 2024

What changes are proposed in this pull request?

Parse: delta.enableInCommitTimestamps, delta.inCommitTimestampEnablementVersion, and delta.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

@github-actions github-actions bot added the breaking-change Change that will require a version bump label Dec 4, 2024
@OussamaSaoudi-db
Copy link
Collaborator

Mention: #559

@zachschuermann zachschuermann changed the title [wip] add in-commit timestamps table properties feat: add in-commit timestamps table properties Feb 5, 2025
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 3 lines in your changes missing coverage. Please review.

Project coverage is 84.09%. Comparing base (68f4790) to head (bf7759d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
kernel/src/table_properties/deserialize.rs 88.88% 0 Missing and 3 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

kernel/src/table_properties.rs Outdated Show resolved Hide resolved
kernel/src/table_properties/deserialize.rs Outdated Show resolved Hide resolved
kernel/src/table_properties/deserialize.rs Outdated Show resolved Hide resolved
kernel/src/table_properties/deserialize.rs Outdated Show resolved Hide resolved
kernel/src/table_properties/deserialize.rs Outdated Show resolved Hide resolved
@zachschuermann zachschuermann requested review from scovich and OussamaSaoudi and removed request for OussamaSaoudi-db February 5, 2025 22:17
Copy link
Collaborator

@OussamaSaoudi OussamaSaoudi left a 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)?)
Copy link
Collaborator

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:

Suggested change
props.in_commit_timestamp_enablement_version = Some(parse_uint(v)?)
props.in_commit_timestamp_enablement_version = parse_uint(v)

Copy link
Collaborator Author

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 :)

Copy link
Collaborator

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

Copy link
Collaborator

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)?

Copy link
Collaborator Author

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

@zachschuermann zachschuermann changed the title feat: add in-commit timestamps table properties feat!: add in-commit timestamps table properties Feb 6, 2025
Copy link
Collaborator

@scovich scovich left a 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)?)
Copy link
Collaborator

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)?

kernel/src/table_properties/deserialize.rs Outdated Show resolved Hide resolved
@zachschuermann zachschuermann merged commit eedfd47 into delta-io:main Feb 6, 2025
21 checks passed
@zachschuermann zachschuermann deleted the ict-table-property branch February 6, 2025 22:36
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);
Copy link
Collaborator

@scovich scovich Feb 6, 2025

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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Change that will require a version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants