Repository navigation
Conversation
|
|
|
|
||
|
|
||
| filter = array_filter | ||
| take = array_take |
There was a problem hiding this comment.
TODO: redefine take rather than alias to exclude Expression
Add type annotation stubs for compute, _compute, _compute_docstring, and _acero modules. These are the stubs of apacheGH-49201 as they were, at their original paths. The type checker accommodations that apacheGH-49201 made in compute.py, acero.py and the PyArrow tests are left out, as the type checkers no longer run on pyarrow/ (see apacheGH-55264).
Add type annotation stubs for compute, _compute, _compute_docstring, and _acero modules. These are the stubs of apacheGH-49201 as they were, at their original paths. The type checker accommodations that apacheGH-49201 made in compute.py, acero.py and the PyArrow tests are left out, as the type checkers no longer run on pyarrow/ (see apacheGH-55264).
Add type annotation stubs for compute, _compute, _compute_docstring, and _acero modules. These are the stubs of apacheGH-49201 as they were, at their original paths. The type checker accommodations that apacheGH-49201 made in compute.py, acero.py and the PyArrow tests are left out, as the type checkers no longer run on pyarrow/ (see apacheGH-55264).
d3f0fb7 to
a78bedf
Compare
29a6b0b to
fb3204a
Compare
|
Given there were changes in the data types PR you might want to rebase or merge them here @AlenkaF. |
e8779e3 to
300602b
Compare
|
Oh, should have squashed, sorry. |
| @@ -0,0 +1,18 @@ | |||
| # Licensed to the Apache Software Foundation (ASF) under one | |||
There was a problem hiding this comment.
Is this file needed or we can remove it?
There was a problem hiding this comment.
I don't remember what this is, I suppose remove.
| from pyarrow import lib | ||
|
|
||
| ArrayLike: TypeAlias = Any | ||
| ScalarLike: TypeAlias = Any |
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.
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.
300602b to
bc6a844
Compare
…ons but also individual functions)
| check(assert_type(field.equals(pc.field("a")), bool), bool) | ||
|
|
||
| # Calling a compute function with an expression builds an expression. | ||
| check(pc.count(field), pc.Expression) |
There was a problem hiding this comment.
Note to myself: add assert_type checks once the scalar stubs land.
|
|
||
| # =============================== Aggregations ======================================== | ||
| def all( | ||
| array: BooleanScalar | _ArrayOrChunkedArray | Expression, |
There was a problem hiding this comment.
To be consistent with decisions made in array.pyi we should use general Scalar class in parameters, not narrow types like BooleanScalar and aliases like _NumericScalar. The narrow types stay for returns.
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.