[
https://issues.apache.org/jira/browse/ARROW-14156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Antoine Pitrou resolved ARROW-14156.
------------------------------------
Resolution: Fixed
Issue resolved by pull request 11344
[https://github.com/apache/arrow/pull/11344]
> [C++] StructArray::Flatten is incorrect in some cases
> -----------------------------------------------------
>
> Key: ARROW-14156
> URL: https://issues.apache.org/jira/browse/ARROW-14156
> Project: Apache Arrow
> Issue Type: Bug
> Components: C++
> Affects Versions: 5.0.0
> Reporter: Micah Kornfield
> Assignee: David Li
> Priority: Major
> Labels: pull-request-available
> Fix For: 6.0.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> When trying to flatten a struct that has children that were sliced we see
> incorrect results.
>
> {code:title=Bar.java|borderStyle=solid}
> import pyarrow as pa
> a = py.array([1,2,3])
> sliceds = a.slice(1)
> composed_struct = pa.StructArray.from_buffers(pa.struct([pa.field("a",
> sliceds.type)]), len(sliceds), [pa.array([True, False]).buffers()[1]],
> children=[sliceds])
> >>> composed_struct
> <pyarrow.lib.StructArray object at 0x7f5502a74880>
> -- is_valid:
> [
> true,
> false
> ]
> -- child 0 type: int64
> [
> 2,
> 3
> ]
> >>> composed_struct.flatten()
> [<pyarrow.lib.Int64Array object at 0x7f5502a74460>
> [
> null,
> null
> ]]
> {code}
>
> I believe the problems is
> [here|https://github.com/apache/arrow/blob/8e43f23dcc6a9e630516228f110c48b64d13cec6/cpp/src/arrow/array/array_nested.cc#L572]
> the copy does not account for child array offset.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)