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] Delta lake allow unsafe rename for local writes #2824

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

kevinzwang
Copy link
Member

@kevinzwang kevinzwang commented Sep 10, 2024

I don't know a good way to test this since we believe this issue only arises when you mount a fabric table onto the local filesystem. However it is a pretty change that should not affect any existing behavior. I will verify that it works with our users once it is released.

@github-actions github-actions bot added the enhancement New feature or request label Sep 10, 2024
Copy link

codspeed-hq bot commented Sep 10, 2024

CodSpeed Performance Report

Merging #2824 will degrade performances by 34.2%

Comparing kevin/delta-unsafe-rename (264f51a) with main (2a89d0d)

Summary

⚡ 1 improvements
❌ 2 regressions
✅ 13 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main kevin/delta-unsafe-rename Change
test_count[1 Small File] 24.1 ms 16.3 ms +48.01%
test_explain[100 Small Files] 33.1 ms 50.3 ms -34.2%
test_show[100 Small Files] 213.5 ms 301.2 ms -29.12%

@kevinzwang kevinzwang marked this pull request as ready for review September 10, 2024 18:47
@kevinzwang kevinzwang added the documentation Improvements or additions to documentation label Sep 10, 2024
Copy link

@@ -825,14 +827,19 @@ def write_deltalake(
raise ValueError(f"Expected table to be a path or a DeltaTable, received: {type(table)}")

# see: https://delta-io.github.io/delta-rs/usage/writing/writing-to-s3-with-locking-provider/
scheme = urlparse(table_uri).scheme
scheme = get_protocol_from_path(table_uri)
if scheme == "s3" or scheme == "s3a":
if dynamo_table_name is not None:
storage_options["AWS_S3_LOCKING_PROVIDER"] = "dynamodb"
storage_options["DELTA_DYNAMO_TABLE_NAME"] = dynamo_table_name
else:
storage_options["AWS_S3_ALLOW_UNSAFE_RENAME"] = "true"
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we also enable allow_unsafe_rename to set AWS_S3_ALLOW_UNSAFE_RENAME here?

Another approach is that we can set ALLOW_UNSAFE_RENAME in storage_options (for all backends) so we don't care what scheme we're in.

Copy link
Member Author

@kevinzwang kevinzwang Sep 10, 2024

Choose a reason for hiding this comment

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

I'm shying away from allowing users to both not set the dynamo table name and set allow_unsafe_rename to false because that would change the default behavior of DataFrame.write_deltalake. In other words, with your suggestion someone would need to manually add allow_unsafe_rename=True to revert back to the behavior they used to see if they didn't specify a dynamo table name.

What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah thats fine then. Let's just go with that

@kevinzwang kevinzwang merged commit 805fbce into main Sep 12, 2024
43 of 44 checks passed
@kevinzwang kevinzwang deleted the kevin/delta-unsafe-rename branch September 12, 2024 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants