Skip to content

Commit 2b12b46

Browse files
authored
Merge pull request #416 from lincc-frameworks/no-fixed-lists
Hot fix of the fixed-length list-column reading
2 parents b86f7c9 + 484c2f5 commit 2b12b46

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/nested_pandas/series/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ def struct_fields(struct_type: pa.StructType) -> list[pa.Field]:
3232
def is_pa_type_a_list(pa_type: pa.DataType) -> bool:
3333
"""Check if the given pyarrow type is a list type.
3434
35-
I.e., one of the following types: ListArray, LargeListArray,
36-
FixedSizeListArray.
35+
Currently, it has to be ListArray, but we plan to support
36+
FixedSizeListArray and LargeListArray as well:
37+
https://github.com/lincc-frameworks/nested-pandas/issues/276
38+
https://github.com/lincc-frameworks/nested-pandas/issues/95
3739
3840
Parameters
3941
----------
@@ -45,9 +47,7 @@ def is_pa_type_a_list(pa_type: pa.DataType) -> bool:
4547
bool
4648
True if the given type is a list type, False otherwise.
4749
"""
48-
return (
49-
pa.types.is_list(pa_type) or pa.types.is_large_list(pa_type) or pa.types.is_fixed_size_list(pa_type)
50-
)
50+
return pa.types.is_list(pa_type)
5151

5252

5353
def is_pa_type_is_list_struct(pa_type: pa.DataType) -> bool:
239 KB
Binary file not shown.

tests/nested_pandas/nestedframe/test_io.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,3 +473,9 @@ def test_normal_loading_error():
473473
# Load in the example file
474474
with pytest.raises(ValueError, match="No match for*"):
475475
read_parquet("tests/test_data/nested.parquet", columns=["not_a_column"])
476+
477+
478+
def test_read_parquet_with_fixed_length_nested():
479+
"""Test reading a parquet file with fixed-length nested arrays"""
480+
nf = read_parquet("tests/fixed_length_data/mmu-desi.parquet")
481+
assert nf.shape == (2, 18)

0 commit comments

Comments
 (0)