Repository navigation
GH-49194: [Python][Annotations] Compute module #49201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rok
wants to merge
35
commits into
apache:main
Choose a base branch
from
rok:pyarrow-stubs-pr4-compute
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,250
−21
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
3dbb498
Add type stubs for the compute and Acero modules
rok 79fc644
Review changes of _acero.pyi
AlenkaF 9884c5c
Review changes of _compute.pyi
AlenkaF 93441bd
Order compute.pyi to match C++ docs
AlenkaF aa7a551
Remove ArrayLike import and define _ArrayLike
AlenkaF 3bf0530
Reorder stubs to match _compute.pyx and C++ api order (not only secti…
AlenkaF b70f4e5
Update count function, add and reorganize tests
AlenkaF c70bbdb
Use general Scalar in parameters, no narrow types
AlenkaF a530395
Review the rest of the aggregations section in compute.pyi
AlenkaF 1437722
Review Arithmetic Arithmetic functions stubs
AlenkaF 765a1bc
Review rounding, log and trig stubs, list ChunkedArray in signatures,…
AlenkaF b40ed25
Update _ArrayLike type alias
AlenkaF 4394741
Replace ScalarLike, review comparison, logical and string stubs
AlenkaF 1b56756
Review containment tests functions
AlenkaF eca0aa9
Remove Expression from aggregation and meta function stubs
AlenkaF 96a8f4c
Review element-wise functions: categorization, selection, transforms …
AlenkaF f9eefdb
Review temporal functions stubs
AlenkaF 8a4eac4
Review the rest of compute.pyi
AlenkaF a77423f
Fix segfault in partition_nth_indices
AlenkaF 7a4ebfb
Update comment for partition_nth_indices test
AlenkaF 12b1440
Remove _compute_docstrings.pyi
AlenkaF f4c18d5
Copilot review - register_* methods and in_types stubs
AlenkaF 0a7f2ce
Copilot review: register_tabular_function and extract_regex
AlenkaF e5001d1
Copilot review - make_struct update
AlenkaF ff99bed
Copilot review - subsecond update
AlenkaF dea6869
Copilot review - list_contains update
AlenkaF d4813f9
Copilot review - list_slice update
AlenkaF 38fb88a
Remove scalar placeholders in compute.pyi
AlenkaF 30064ca
Define shared NumericLiteral and TemporalLiteral
AlenkaF d609f7f
Widen 7 compute stubs to use _Literal type alias
AlenkaF 0cbcd7d
Rename variables in the tests
AlenkaF 37ee98f
Clear TODOs in tests
AlenkaF 04add2c
Add missing assert_type checks in test_compute
AlenkaF b4d5792
Update scalar import in _compute.pyi also
AlenkaF 0394026
Resolve TODO(GH-29828)
AlenkaF File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| import pytest | ||
|
|
||
| import pyarrow as pa | ||
|
|
||
| from _check import assert_type, check | ||
|
|
||
| # PyArrow can be built without Acero. | ||
| pytest.importorskip("pyarrow._acero") | ||
|
|
||
| from pyarrow._acero import ( # noqa: E402 | ||
| AggregateNodeOptions, | ||
| Declaration, | ||
| TableSourceNodeOptions, | ||
| ) | ||
|
|
||
|
|
||
| def test_declaration() -> None: | ||
| table = pa.table({"a": [1, 2]}) | ||
| decl = Declaration("table_source", TableSourceNodeOptions(table)) | ||
| check(assert_type(decl, Declaration), Declaration) | ||
| check(assert_type(decl.to_table(), pa.Table), pa.Table) | ||
|
|
||
| if TYPE_CHECKING: | ||
| TableSourceNodeOptions(table.to_batches()[0]) # type: ignore[arg-type] | ||
|
|
||
|
|
||
| def test_aggregate() -> None: | ||
| aggr_opts = AggregateNodeOptions([(["a"], "sum", None, "a_sum")]) | ||
| check(assert_type(aggr_opts, AggregateNodeOptions), AggregateNodeOptions) | ||
|
|
||
| aggr_opts = AggregateNodeOptions([(("a", ), "sum", None, "a_sum")]) | ||
| check(assert_type(aggr_opts, AggregateNodeOptions), AggregateNodeOptions) | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👨 Are we going to test without acero?