Implement ParquetFormatModel and update write_file to use the format API#3381
Open
nssalian wants to merge 3 commits into
Open
Implement ParquetFormatModel and update write_file to use the format API#3381nssalian wants to merge 3 commits into
nssalian wants to merge 3 commits into
Conversation
Contributor
Author
|
@kevinjqliu @Fokko @geruh PTAL when you can |
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
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.
Continued work on #3100
PR Description
Follow-up to #3119. Implements
ParquetFormatWriterandParquetFormatModel, registers Parquet in theFileFormatFactory, and rewriteswrite_fileto dispatch through the factory using thewrite.format.defaulttable property. Future formats can be added in a similar way.Rationale for this change
The
write.format.defaulttable property was never read - the write path was hardcoded to Parquet. This PR makes the property functional. Also threadsfile_formatthrough_to_requested_schema/ArrowProjectionVisitor/_construct_fieldso field ID metadata keys are correct per format (PARQUET:field_idfor Parquet,iceberg.idplusiceberg.requiredfor ORC), preparing the write path for ORC support without changing default behavior.Are these changes tested?
tests/io/test_format_writers.pyadds parametrized tests modeled after Java'sBaseFormatModelTestscovering round-trip, statistics, null handling, context manager caching, close idempotency, close-without-write, and ORC vs Parquet field ID dispatch.tests/io/test_pyarrow.pyaddstest_write_file_parquet_round_tripandtest_write_file_dispatches_on_write_format_defaultexercising the fullwrite_filepath.Are there any user-facing changes?
No. Default behavior is unchanged. Setting
write.format.defaultto an unregistered format now raises aValueError.