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.
…cceed when possible Zero-copy conversion of a Table or RecordBatch into a pandas DataFrame was always failing with "Cannot do zero copy conversion into multi-column DataFrame block": in the consolidated-block path (split_blocks=False), allow_zero_copy_blocks is never enabled, so the zero-copy check raises even for a single column. When zero_copy_only=True is requested, convert the columns as separate pandas blocks (as if split_blocks=True had been given): a multi-column block cannot reference the original Arrow memory, while per-column blocks can. Conversions that genuinely need to copy still raise ArrowInvalid (e.g. columns with nulls, or strings_to_categorical / categories). Documented the behavior in the zero_copy_only parameter description and added regression tests.
The archery numpydoc validation currently only reports a fixed set of rules (--allow-rule ...), and PR02 (Unknown parameters) is not part of it, so parameters documented in a docstring but absent from the actual signature are never reported. Also, numpydoc only compares documented parameters against the signature when it can introspect the latter, which for cython generated callables depends on parsing the signature from the first docstring line. Fix the signature parsing in archery so that more cython signatures become introspectable: - skip parameter annotations (e.g. "retry_strategy: S3RetryStrategy = AwsStandardS3RetryStrategy(max_attempts=3)" in S3FileSystem), which _signature_fromstr does not support - drop a trailing bare keyword-only marker, e.g. LocalFileSystem(use_mmap=False, *) - if parsing still fails because a default value is not a constant expression, retry without the default values, as the parameter names, kinds and order are what matter for the docstring validation When the signature cannot be determined at all (e.g. the docstring has no embedded signature line, like ParquetEncryptionConfig), skip the PR01/PR02/PR03 rules instead of comparing against an empty signature, which would report every documented parameter as unknown. Fix the violations that remain once PR02 is reported: - ParquetWriter documents coerce_timestamps, allow_truncated_timestamps and data_page_size, but they were only accepted via **options; make them explicit parameters instead, matching write_table - read_pandas reused the read_table docstring template, documenting all of read_table's parameters that are only accepted via **kwargs; give it a docstring for its own parameters instead - reorder the S3FileSystem docstring parameters to match the __init__ signature order (PR03) Finally enable PR02 in the validation run of the conda-python-docs job. The changes were verified locally by running the validation against an installed pyarrow wheel overlaid with the pure-Python modules (PR02 violations go from 6 to 0) and by writing/reading Parquet files with the changed ParquetWriter parameters. The new archery parsing is unit tested in dev/archery/archery/tests/test_numpydoc.py.
sameer727
requested review from
AlenkaF,
assignUser,
jonkeane,
kou,
pitrou,
raulcd and
rok
as code owners
November 22, 2026 18:46
Member
|
Closing this PR as it doesn't meet our guidelines on AI-generated contributions: https://arrow.apache.org/docs/developers/overview.html#ai-generated-code If you'd like to contribute this change, please review and test the code yourself, then open a new PR. |
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
The numpydoc validation run (
archery numpydoc --allow-rule GL10,PR01,PR03,PR04,PR05,PR10,RT03,YD01in theconda-python-docsjob) never reports PR02 (Unknown parameters), so parameters that are documented in a docstring but absent from the actual signature go unnoticed (#51260). Additionally, the PR02/PR03 comparison only happens when numpydoc can introspect the signature, which for cython generated callables depends on archery parsing the signature from the first docstring line — a step that currently fails for several objects and silently disables the parameter checks for them.What changes are included in this PR?
dev/archery/archery/lang/python.py):_signature_fromstr), e.g.retry_strategy: S3RetryStrategy = AwsStandardS3RetryStrategy(max_attempts=3)inS3FileSystem;LocalFileSystem(use_mmap=False, *);ParquetEncryptionConfig), skip the PR01/PR02/PR03 rules instead of comparing the documented parameters against an empty signature, which would report every documented parameter as unknown.python/pyarrow/parquet/core.py:ParquetWriterdocumentscoerce_timestamps,allow_truncated_timestampsanddata_page_size, but they were only accepted via**options; they are now explicit parameters, matchingwrite_table.read_pandasreused theread_tabledocstring template and documented all ofread_table's**kwargsoptions as if they were its own parameters; it now has a docstring for its own parameters, pointing toread_tablefor the rest.python/pyarrow/_s3fs.pyx: reorder theS3FileSystemdocstring parameters to match the__init__signature order (PR03).compose.yaml: enable PR02 in the validation run.Are these changes tested?
dev/archery/archery/tests/test_numpydoc.py(9 tests, run locally).archery numpydoc --allow-rule GL10,PR01,PR02,PR03,PR04,PR05,PR10,RT03,YD01against an installed pyarrow 24.0.0 wheel whose pure-Python modules were overlaid with this PR's versions: PR02 violations go from 6 objects to 0. (ParquetEncryptionConfig/ParquetDecryptionConfig/OSFileuse the new skip-when-undeterminable behavior;S3FileSystem/LocalFileSystemparse after the parser fixes;read_pandas/ParquetWriterare fixed in this PR. The remaining locally-reported PR03 items are pre-existing allowed-rule noise: one comes from the pyarrow 24 wheel's baked-inS3FileSystemdocstring, which this PR reorders in_s3fs.pyxfor main, and one fromParquetWriter, whose docstring order differs from the signature — same as forwrite_table.)ParquetWriterparameters were verified functionally by writing Parquet files withcoerce_timestamps='ms',allow_truncated_timestamps,data_page_size, the legacy**optionspath (metadata_collector) and no arguments, and reading the metadata back.Are there any user-facing changes?
ParquetWriteracceptscoerce_timestamps,allow_truncated_timestampsanddata_page_sizeas explicit keyword arguments (they previously worked via**options).read_pandas' rendered docstring now documents its own parameters; the available options are documented inread_table, to which**kwargsare passed.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 root causes were identified by running the archery numpydoc validation locally against an installed pyarrow wheel (reproducing the violations from the issue), and every change was verified locally: the parser fixes by unit tests and by parsing the real objects (
S3FileSystem,LocalFileSystem), theParquetWriterchange by writing/reading files with the affected parameters, and the overall effect by the validation run going from 6 PR02 violations to 0.