Skip to content
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

Fix flatten array with sliced input #73

Merged
merged 8 commits into from
Jul 29, 2024
Merged

Conversation

kylebarron
Copy link
Owner

@kylebarron kylebarron commented Jul 26, 2024

We should add a test for this before merging

In [1]: import pyarrow as pa

In [2]: from arro3.compute import list_flatten

In [3]: list_arr = pa.array([[1, 2], [3, 4]])

In [4]: pa.array(list_flatten(list_arr))
Out[4]:
<pyarrow.lib.Int64Array object at 0x107390160>
[
  1,
  2,
  3,
  4
]

In [5]: sliced = list_arr.slice(1, 2)

In [6]: pa.array(list_flatten(sliced))
Out[6]:
<pyarrow.lib.Int64Array object at 0x106f927a0>
[
  3,
  4
]

In [7]: sliced = list_arr.slice(0, 1)

In [8]: pa.array(list_flatten(sliced))
Out[8]:
<pyarrow.lib.Int64Array object at 0x10701c400>
[
  1,
  2
]

@kylebarron
Copy link
Owner Author

Oh struct_field would have the same problem with sliced input...

@kylebarron
Copy link
Owner Author

Ref: apache/arrow-rs#6151

@kylebarron kylebarron merged commit eac16fe into main Jul 29, 2024
3 checks passed
@kylebarron kylebarron deleted the kyle/fix-flatten-array-slicing branch July 29, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant