FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Support Parquet writer options by nuno-faria · Pull Request #1123 · apache/datafusion-python · GitHub

feat: Support Parquet writer options - #1123

Merged
timsaucer merged 6 commits into
apache:mainfrom
nuno-faria:write_parquet_options
Jun 21, 2025
Merged

feat: Support Parquet writer options#1123
timsaucer merged 6 commits into
apache:mainfrom
nuno-faria:write_parquet_options

Conversation

nuno-faria commented May 5, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

N/A.

Rationale for this change

Supporting all Parquet writer options allows us more flexibility when creating data directly from datafusion-python.

For consistency, it supports all writer options defined by ParquetOptions in datafusion, using the same defaults: https://github.com/apache/datafusion/blob/555fc2e24dd669e44ac23a9a1d8406f4ac58a9ed/datafusion/common/src/config.rs#L423.

What changes are included in this PR?

  • Extended write_parquet with all writer options, including column-specific options.
  • Added relevant tests. (Since pyarrow does not expose page-level information, some options could not be directly tested, like enabling bloom-filters (an external tool confirmed that this option works). For this specific case, there is a test that compares the file sizes.)

Are there any user-facing changes?

The main difference relates to the existing compression field, which now uses a str like datafusion, instead of a custom enum. The main advantage is that future algorithms will not require updating the Python-side code.

Additionally, the default compression was changed from zstd(4) to zstd(3), the same as datafusion.

timsaucer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Overall, I really like the idea. Right now this does include a breaking change to a very popular user facing function. I think if we make the suggestion to allow for two function signatures we'll be able to include this in the next release.

Comment thread python/datafusion/dataframe.py Outdated
Comment thread python/tests/test_dataframe.py Outdated

timsaucer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Very nice. Thank you!

I might add a follow on PR that would overload the write_parquet to simply identify it was getting passed these options or the old signature. I don't think that's blocking for what you have here.

I think write_parquet_with_options would be a slightly more explicit function name, but also not blocking for this PR.

If you can resolve the merge conflicts, I'll rerun CI and if all goes through I can merge it in soon.

Thank you again!

Copy link
Copy Markdown
Contributor Author

Conflicts are resolved. I also renamed to write_parquet_with_options.

Copy link
Copy Markdown
Member

Looks great. There are some minor ruff errors. After that it looks good to merge!

timsaucer merged commit 98dc06b into apache:main Jun 21, 2025
nuno-faria deleted the write_parquet_options branch June 30, 2025 09:42
This file contains hidden or 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
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.

2 participants


Back | FazBrowse Home | New Git URL