dannyshafer opened a new pull request, #51679:
URL: https://github.com/apache/arrow/pull/51679

   ### Rationale for this change
   
   As reported in #44741, `ParquetFile.schema.names` returns 
`['random_strings1', 'element', 'random_strings2']` for a file with a list 
column, while `ParquetFile.schema_arrow.names` returns the actual column name 
`my_list`. This is expected (the Parquet schema describes the leaf columns, and 
`ParquetColumnSchema.name` is the leaf node name), but the docstrings ("Name of 
each field", "A Parquet schema") do not say so, which is what confused the 
reporter.
   
   ### What changes are included in this PR?
   
   Docstring-only:
   
   - `ParquetSchema`: explain that its length, indexing and `names` refer to 
the leaf columns, and point to `to_arrow_schema()` for the top-level fields.
   - `ParquetSchema.names`: say it is the leaf column name, mention 
`ColumnSchema.path` for the full dotted path and `to_arrow_schema().names` for 
top-level names, and add an example with a list column.
   - `ParquetFile.schema`: the same note, pointing to `schema_arrow`.
   
   ### Are these changes tested?
   
   Docstring-only change. I ran the new `ParquetSchema.names` example with 
doctest against pyarrow 25.0.1 (8 examples, 0 failures) and checked the output 
(`['n_legs', 'element']`, `['n_legs', 'tags.list.element']`, `['n_legs', 
'tags']`). `cython-lint --max-line-length 88` reports nothing for the changed 
lines and `flake8` on `core.py` is clean.
   
   ### Are there any user-facing changes?
   
   Only the rendered docstrings.
   
   ### Was AI used for this PR?
   
   In accordance to the [AI generation 
guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code),
 please disclose below whether and how AI was used in this PR.
   
   This PR was prepared with Claude Code, which reproduced the behaviour from 
the issue, wrote the docstring changes and example, ran the example, and 
drafted this description.
   
   **PR code and description written by:**
   
   - [ ] Human
   - [x] AI
   
   **Reviewed before submission by:**
   
   - [ ] Human
   - [x] AI
   - [ ] Not reviewed
   
   * GitHub Issue: #44741
   
   <!-- oss-routine -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to