Repository navigation
Conversation
|
|
rok
commented
Feb 9, 2026
|
|
||
|
|
||
| filter = array_filter | ||
| take = array_take |
Member
Author
There was a problem hiding this comment.
TODO: redefine take rather than alias to exclude Expression
Co-authored-by: Dan Redding <125183946+dangotbanned@users.noreply.github.com>
Co-authored-by: Dan Redding <125183946+dangotbanned@users.noreply.github.com>
Co-authored-by: Dan Redding <125183946+dangotbanned@users.noreply.github.com>
Co-authored-by: Dan Redding <125183946+dangotbanned@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Add type annotation stubs for array, table, tensor, builder, memory, device, config, and types modules. Includes type-ignore annotations in related tests.
Drop the TypeVar/Generic parameters from the DataType subclasses, Field, Array, ChunkedArray and the tabular classes. Where a property can only return one of a few types (dictionary index type, run end type, time units) it now returns a union or Literal instead. Most of these parameters weren't buying much yet: scalar.pyi and lib.pyi are still placeholders, so e.g. Array[Scalar[...]] collapsed to Any anyway, and several annotations were being flagged by mypy and pyright (TypeVars used only once, type arguments on subclasses that weren't actually generic). Plain classes are a lot easier to read and review, and we can bring parameters back later where they clearly pay off. This also removes the stub-only _BasicDataType and _HasPrecisionScale helpers, which have no runtime counterpart, plus the IntoArray and SingleOrList aliases.
Co-authored-by: tadeja <tadeja@users.noreply.github.com>
This reverts commit cf459f4.
Co-authored-by: Rok Mihevc <rok@mihevc.org>
Member
Author
|
Given there were changes in the data types PR you might want to rebase or merge them here @AlenkaF. |
Annotate pyarrow.compute, pyarrow._compute, pyarrow._acero and pyarrow._compute_docstrings, following the approach of apacheGH-55264: plain classes and unions instead of generics, in the flat pyarrow-stubs/ layout. - Array arguments accept any Array or ChunkedArray, since pa.array() and most of the API return plain Array instances. The return types name the kind of array where the function determines it. The scalar classes are placeholders (Any) until scalar.pyi is annotated. - The signatures match the runtime, as checked by stubtest. - pyarrow.compute and pyarrow._compute are type checked instead of being treated as Any. - Add type annotation tests for the compute and Acero stubs.
AlenkaF
force-pushed
the
pyarrow-stubs-pr4-compute
branch
from
November 18, 2026 05:21
e8779e3 to
300602b
Compare
Member
|
Oh, should have squashed, sorry. |
AlenkaF
reviewed
Nov 18, 2026
| @@ -0,0 +1,18 @@ | |||
| # Licensed to the Apache Software Foundation (ASF) under one | |||
Member
There was a problem hiding this comment.
Is this file needed or we can remove it?
AlenkaF
reviewed
Nov 18, 2026
| from pyarrow import lib | ||
|
|
||
| ArrayLike: TypeAlias = Any | ||
| ScalarLike: TypeAlias = Any |
Member
There was a problem hiding this comment.
Note to myself: when #55592 is merged, update the ScalarLike alias and make sure to narrow return types that use this alias.
4 of 5 tasks
AlenkaF
reviewed
Nov 18, 2026
| @@ -25,6 +25,7 @@ from pyarrow.lib import Array, ChunkedArray | |||
| from pyarrow import lib | |||
|
|
|||
| ArrayLike: TypeAlias = Any | |||
Member
There was a problem hiding this comment.
Note to myself: define a separate private _ArrayLike type alias for compute stubs only (after comment #55264 (comment) is resolved).
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
Closes: #49194
What changes are included in this PR?
Adds type annotation stubs for compute, _compute, _compute_docstring, and _acero modules. Includes source fixes in compute.py and acero.py, and type-ignore annotations in related tests.
Are these changes tested?
Yes, by CI.
Are there any user-facing changes?
Compute module functions will be type annotated.