-
Notifications
You must be signed in to change notification settings - Fork 15
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
Compatibility with latest dask, pyarrow and deltalake #68
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c2e6839
Move internal private import
mrocklin 3cc7678
add version requirement
mrocklin b2d042a
use public name and fix deprecation warning
fjetter dfa33d7
use same types_mapper as dask/dask
fjetter bce9d82
expect same behavior in delta and dask regarding types
fjetter f0d4956
fix another typing thing
fjetter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,10 +23,10 @@ | |
DeltaProtocolError, | ||
DeltaStorageHandler, | ||
__enforce_append_only, | ||
_write_new_deltalake, | ||
get_file_stats_from_metadata, | ||
get_partitions_from_path, | ||
try_get_table_and_table_uri, | ||
write_deltalake_pyarrow, | ||
) | ||
from toolz.itertoolz import pluck | ||
|
||
|
@@ -54,6 +54,7 @@ def to_deltalake( | |
storage_options: dict[str, str] | None = None, | ||
partition_filters: list[tuple[str, str, Any]] | None = None, | ||
compute: bool = True, | ||
custom_metadata: dict[str, str] | None = None, | ||
): | ||
"""Write a given dask.DataFrame to a delta table. The returned value is a Dask Scalar, | ||
and the writing operation is only triggered when calling ``.compute()`` | ||
|
@@ -216,9 +217,10 @@ def to_deltalake( | |
configuration, | ||
storage_options, | ||
partition_filters, | ||
custom_metadata, | ||
) | ||
} | ||
graph = HighLevelGraph.from_collections(final_name, dsk, dependencies=(written,)) | ||
graph = HighLevelGraph.from_collections(final_name, dsk, dependencies=(written,)) # type: ignore | ||
result = Scalar(graph, final_name, "") | ||
Comment on lines
+223
to
224
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll migrate to dask-expr in a follow up PR once this is green |
||
if compute: | ||
result = result.compute() | ||
|
@@ -237,6 +239,7 @@ def _commit( | |
configuration, | ||
storage_options, | ||
partition_filters, | ||
custom_metadata, | ||
): | ||
schemas = list(flatten(pluck(0, schemas_add_actions_nested))) | ||
add_actions = list(flatten(pluck(1, schemas_add_actions_nested))) | ||
|
@@ -250,7 +253,7 @@ def _commit( | |
schema = validate_compatible(schemas) | ||
assert schema | ||
if table is None: | ||
_write_new_deltalake( | ||
write_deltalake_pyarrow( | ||
table_uri, | ||
schema, | ||
add_actions, | ||
|
@@ -260,6 +263,7 @@ def _commit( | |
description, | ||
configuration, | ||
storage_options, | ||
custom_metadata, | ||
) | ||
else: | ||
table._table.create_write_transaction( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
dask[dataframe] | ||
deltalake | ||
deltalake>=0.15 | ||
fsspec | ||
pyarrow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 import is a bit ugly but this class exposes our type mappers and this way we can align behavior