-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support revertable for concatenate in pyarrow logic (#2889)
* wip: fix revertable for concatenate * test: ensure behavior! * test: fix importorskip arrow
- Loading branch information
Showing
2 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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,49 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE | ||
|
||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
import awkward as ak | ||
|
||
pa = pytest.importorskip("pyarrow") | ||
|
||
|
||
def test_strings(): | ||
array = pa.chunked_array([["foo", "bar"], ["blah", "bleh"]]) | ||
ak_array = ak.from_arrow(array) | ||
assert ak_array.type == ak.types.ArrayType( | ||
ak.types.ListType( | ||
ak.types.NumpyType("uint8", parameters={"__array__": "char"}), | ||
parameters={"__array__": "string"}, | ||
), | ||
4, | ||
) | ||
|
||
|
||
def test_strings_option(): | ||
array = pa.chunked_array([["foo", "bar"], ["blah", "bleh", None]]) | ||
ak_array = ak.from_arrow(array) | ||
assert ak_array.type == ak.types.ArrayType( | ||
ak.types.OptionType( | ||
ak.types.ListType( | ||
ak.types.NumpyType("uint8", parameters={"__array__": "char"}), | ||
parameters={"__array__": "string"}, | ||
) | ||
), | ||
5, | ||
) | ||
|
||
|
||
def test_numbers(): | ||
array = pa.chunked_array([[1, 2, 3], [4, 5]]) | ||
ak_array = ak.from_arrow(array) | ||
assert ak_array.type == ak.types.ArrayType(ak.types.NumpyType("int64"), 5) | ||
|
||
|
||
def test_numbers_option(): | ||
array = pa.chunked_array([[1, 2, 3], [4, 5, None]]) | ||
ak_array = ak.from_arrow(array) | ||
assert ak_array.type == ak.types.ArrayType( | ||
ak.types.OptionType(ak.types.NumpyType("int64")), 6 | ||
) |