Skip to content

GH-55782: [Python][Annotations] Fix stubs for chunked inputs and string/bytes key mappings - #55803

Draft
tadeja wants to merge 3 commits into
apache:mainfrom
tadeja:stubs-55782-Mapping
Draft

tadeja wants to merge 3 commits into
apache:mainfrom
tadeja:stubs-55782-Mapping

Conversation

@tadeja

@tadeja tadeja commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

Closes #55782, follow-up to #55782. Some type annotations don't match runtime behavior.

What changes are included in this PR?

  • Array.take()/filter()/fill_null() return ChunkedArray for chunked indices, mask or fill_value -> overloads
  • RecordBatch.take() no longer accepts chunked indices but Table.take() still does as it should
  • metadata and fields arguments of pa.schema()/struct() accept mappings with only str or only bytes keys. metadata alias is now MetadataMapping

Are these changes tested?

New test cases added in pyarrow-stubs-tests/

Are there any user-facing changes?

No, just improved type annotation stubs.

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:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

@tadeja tadeja changed the title GH-55782: [Python][Annotations] chunked inputs and string/bytes key mappings GH-55782: [Python][Annotations] Fix stubs for chunked inputs and string/bytes key mappings Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python][Annotations] Consider improving stubs for chunked inputs and string/bytes key mappings

1 participant