[
https://issues.apache.org/jira/browse/ARROW-7363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16992519#comment-16992519
]
Joris Van den Bossche commented on ARROW-7363:
----------------------------------------------
>From looking at the code, I_think_ that the ChunkedArray {{flatten()}} method
>maps to the StructArray.flatten() method, and not to the ListArray.flatten()
>method.
StructArray and ListArray implement (somewhat unfortunately maybe) a different
flatten method: for StructArray it returns a list of arrays (returning one
individual array for each field in the struct), while ListArray returns a new
Array with one level of nesting reduced (list array -> array, or list of list
array -> list array, ..).
I am not fully sure how to deal with this. Should ChunkedArray.flatten do
something different depending on the type? (but it's also not nice that the
type of return is then variable) Should be rename the {{flatten()}} method for
ListArrays ?
> [Python] flatten() doesn't work on ChunkedArray
> -----------------------------------------------
>
> Key: ARROW-7363
> URL: https://issues.apache.org/jira/browse/ARROW-7363
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Affects Versions: 0.15.1
> Reporter: marc abboud
> Priority: Major
>
> Flatten() doesn't work on ChunkedArray. It returns only the ChunkedArray in a
> list without flattening anything.
> {code:java}
> // code placeholder
> aa = pa.array([[1],[2]])
> bb = pa.chunked_array([aa,aa])
>
> bb.flatten()
> Out[15]:
> [<pyarrow.lib.ChunkedArray object> [ [ [ 1 ], [ 2 ] ], [ [ 1 ], [ 2 ] ] ]]
> Expected:
> [ <pyarrow.lib.Array object> [ 1, 2 ], <pyarrow.lib.Array object> [ 1, 2 ] ]
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)