Skip to content

feat: add classic and uuid parquet checkpoint path generation #782

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

Merged
merged 16 commits into from
Apr 7, 2025

Conversation

sebastiantia
Copy link
Collaborator

@sebastiantia sebastiantia commented Mar 31, 2025

What changes are proposed in this pull request?

This PR introduces the helper methods:

  • new_uuid_parquet_checkpoint which creates a new ParsedCheckpointPath<Url> for a uuid-named parquet checkpoint file at the specified version. The UUID-naming scheme looks like: n.checkpoint.u.parquet, where u is a UUID and n is the snapshot version that this checkpoint represents.
  • new_classic_parquet_checkpoint which creates a new ParsedCheckpointPath<Url> for a classic-named parquet checkpoint file at the specified version. The classic-naming scheme looks like: n.checkpoint.parquet, where n is the snapshot version that this checkpoint represents.
  • Updates the uuid dependency to always include v4 and fast-rng features:
    • This ensures that uuid::new_v4() is always available.
    • The fast-rng feature improves performance when generating UUIDs.

For more information on the two checkpoint naming-schemes:
https://github.com/delta-io/delta/blob/master/PROTOCOL.md#uuid-named-checkpoint
https://github.com/delta-io/delta/blob/master/PROTOCOL.md#classic-checkpoint

This PR is part of the on-going effort to implement single-file checkpoint write support. For reference, [link to write API proposal]

How was this change tested?

  • test_new_uuid_parquet_checkpoint - verifies UUID-named Parquet checkpoint creation with proper attributes.
  • test_new_classic_parquet_checkpoint - verifies classic-named Parquet checkpoint creation with proper attributes.

Copy link

codecov bot commented Mar 31, 2025

Codecov Report

Attention: Patch coverage is 76.19048% with 15 lines in your changes missing coverage. Please review.

Project coverage is 84.65%. Comparing base (4ad2bc6) to head (c95e5c9).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
kernel/src/path.rs 76.19% 8 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #782      +/-   ##
==========================================
- Coverage   84.67%   84.65%   -0.02%     
==========================================
  Files          83       83              
  Lines       19780    19836      +56     
  Branches    19780    19836      +56     
==========================================
+ Hits        16748    16792      +44     
- Misses       2213     2221       +8     
- Partials      819      823       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@zachschuermann zachschuermann left a comment

Choose a reason for hiding this comment

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

looks good, just a comment on simplification

Copy link
Collaborator

@zachschuermann zachschuermann left a comment

Choose a reason for hiding this comment

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

comment again on simplifying - sorry for taking you back in the other direction now!

@zachschuermann zachschuermann requested a review from roeap April 2, 2025 16:00
Copy link
Collaborator

@roeap roeap left a comment

Choose a reason for hiding this comment

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

overall looking good, just raised one point around errors, but would just follow other folks opinions on this :)

Comment on lines +213 to +217
if !path.is_checkpoint() {
return Err(Error::internal_error(
"ParsedLogPath::new_classic_parquet_checkpoint created a non-checkpoint path",
));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

we do this for commits as well, however since the user cannot really do anything about this (we are generating the file name, and deciding what the log folder is), this feels we should catch this at test time. i.e. are we not just validating that the logic we use to generate a path is compatible with how we check if a path is a checkpoint?

In other words, whenever this raises, it points to a bug in our code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're absolutely right—if this check ever fails, it would indicate a bug in our path generation logic rather than something the user can control. Given that this test coverage already exists, we likely don’t need the runtime checks. Do you think there's additional value of keeping the checks? @zachschuermann

Copy link
Collaborator

Choose a reason for hiding this comment

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

fair - I wonder if we could do better in the future by having the types encode whether or not it is checkpoint etc. (then it wouldn't be a runtime check here - if you have a checkpoint-specific constructor and a checkpoint type then you are guaranteed to get back a checkpoint)

given that this is no different than what we had before (and it's InternalError) how about we take this as a follow up?

@sebastiantia can you make an issue?

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.

Since this changes our dependency setup, should we wait to merge until we actually have a use for the code? Or worth it to merge this separately?

@sebastiantia
Copy link
Collaborator Author

Since this changes our dependency setup, should we wait to merge until we actually have a use for the code? Or worth it to merge this separately?

I think this is reasonable, I have a few other PRs for checkpoint write support (tracked here #795) that need to merge before I can leverage this code (in #797). But I did plan to merge this as a separate PR for ease of reviews.

@sebastiantia sebastiantia requested a review from scovich April 3, 2025 16:53
Copy link
Collaborator

@zachschuermann zachschuermann left a comment

Choose a reason for hiding this comment

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

LGTM after addressing a couple quick things

Comment on lines +213 to +217
if !path.is_checkpoint() {
return Err(Error::internal_error(
"ParsedLogPath::new_classic_parquet_checkpoint created a non-checkpoint path",
));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

fair - I wonder if we could do better in the future by having the types encode whether or not it is checkpoint etc. (then it wouldn't be a runtime check here - if you have a checkpoint-specific constructor and a checkpoint type then you are guaranteed to get back a checkpoint)

given that this is no different than what we had before (and it's InternalError) how about we take this as a follow up?

@sebastiantia can you make an issue?

@sebastiantia sebastiantia merged commit c84b079 into delta-io:main Apr 7, 2025
19 of 21 checks passed
@sebastiantia sebastiantia deleted the create_checkpoint_paths branch April 7, 2025 20:54
zachschuermann pushed a commit to hntd187/delta-kernel-rs that referenced this pull request Apr 8, 2025
…io#782)

<!--
Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
https://github.com/delta-incubator/delta-kernel-rs/blob/main/CONTRIBUTING.md
2. Run `cargo t --all-features --all-targets` to get started testing,
and run `cargo fmt`.
  3. Ensure you have added or run the appropriate tests for your PR.
4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]
Your PR title ...'.
  5. Be sure to keep the PR description updated to reflect all changes.
-->

<!--
PR title formatting:
This project uses conventional commits:
https://www.conventionalcommits.org/

Each PR corresponds to a commit on the `main` branch, with the title of
the PR (typically) being
used for the commit message on main. In order to ensure proper
formatting in the CHANGELOG please
ensure your PR title adheres to the conventional commit specification.

Examples:
- new feature PR: "feat: new API for snapshot.update()"
- bugfix PR: "fix: correctly apply DV in read-table example"
-->

## What changes are proposed in this pull request?
<!--
Please clarify what changes you are proposing and why the changes are
needed.
The purpose of this section is to outline the changes, why they are
needed, and how this PR fixes the issue.
If the reason for the change is already explained clearly in an issue,
then it does not need to be restated here.
1. If you propose a new API or feature, clarify the use case for a new
API or feature.
  2. If you fix a bug, you can clarify why it is a bug.
-->

This PR introduces the helper methods:
- `new_uuid_parquet_checkpoint` which creates a new
`ParsedCheckpointPath<Url>` for a uuid-named parquet checkpoint file at
the specified version. The UUID-naming scheme looks like:
`n.checkpoint.u.parquet`, where u is a UUID and n is the snapshot
version that this checkpoint represents.
- `new_classic_parquet_checkpoint` which creates a new
`ParsedCheckpointPath<Url>` for a classic-named parquet checkpoint file
at the specified version. The classic-naming scheme looks like:
`n.checkpoint.parquet`, where n is the snapshot version that this
checkpoint represents.
- **Updates the `uuid` dependency to always include `v4` and `fast-rng`
features:**
     - This ensures that `uuid::new_v4()` is always available.
- The `fast-rng` feature improves performance when generating UUIDs.




For more information on the two checkpoint naming-schemes:

https://github.com/delta-io/delta/blob/master/PROTOCOL.md#uuid-named-checkpoint

https://github.com/delta-io/delta/blob/master/PROTOCOL.md#classic-checkpoint

This PR is part of the on-going effort to implement single-file
checkpoint write support. For reference, [[link to write API
proposal]](delta-io#779)

<!--
Uncomment this section if there are any changes affecting public APIs:
### This PR affects the following public APIs

If there are breaking changes, please ensure the `breaking-changes`
label gets added by CI, and describe why the changes are needed.

Note that _new_ public APIs are not considered breaking.
-->


## How was this change tested?
<!--
Please make sure to add test cases that check the changes thoroughly
including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please
clarify how you tested, ideally via a reproducible test documented in
the PR description.
-->

- `test_new_uuid_parquet_checkpoint` - verifies UUID-named Parquet
checkpoint creation with proper attributes.
- `test_new_classic_parquet_checkpoint` - verifies classic-named Parquet
checkpoint creation with proper attributes.
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.

4 participants