Repository navigation
Conversation
…eld kernel The struct_field kernel accepts a FieldRef in StructFieldOptions, but the compute documentation only described the sequence-of-indices form. Document that the reference can be a FieldPath of child indices, a field name, or a nested sequence of these, with field-name examples added alongside the existing index examples. Also fix the union example, which referred to a child array "a" that does not exist in the sparse_union type used there.
…tioned dataset When writing a partitioned dataset with pq.write_to_dataset, the partition columns are not stored in the data files (they are encoded in the directory names). The collected file metadata therefore has a schema without those columns, and calling pq.write_metadata with the full table schema for the _metadata file fails with "AppendRowGroups requires equal schemas". Add an example to the "Writing _metadata and _common_metadata files" section showing how to write the metadata files for a partitioned dataset: the _common_metadata file gets the full dataset schema, while the partition columns need to be removed from the schema passed for the _metadata file. The example was verified with pyarrow 24.
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.
Rationale for this change
When writing a partitioned dataset with
pq.write_to_dataset, the partition columns are not stored in the data files (they are encoded in the directory names). Callingpq.write_metadatawith the full table schema for the_metadatafile fails with "AppendRowGroups requires equal schemas" (#31678). As suggested in the issue, this adds a partitioned example to the docs.What changes are included in this PR?
_metadataand_common_metadatafiles" section of the Python parquet docs, showing that:_common_metadatais written with the full dataset schema (including the partition columns),_metadatafile.Are these changes tested?
Documentation-only change; no code behavior changes. The exact example was verified by running it locally with pyarrow 24.0.0: writing a two-column-partitioned dataset, writing both metadata files, and reading the dataset back with
pq.ParquetDatasetandpyarrow.dataset.dataset(partition columns are restored from the directory structure on read).Are there any user-facing changes?
Documentation only.
Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
PR code and description written by:
Reviewed before submission by:
This PR was prepared with an AI coding agent (ZCode) at the direction of the submitter. The docs example was verified by execution locally (see "Are these changes tested?").