[
https://issues.apache.org/jira/browse/ARROW-2314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16400818#comment-16400818
]
ASF GitHub Bot commented on ARROW-2314:
---------------------------------------
pitrou commented on a change in pull request #1757: [WIP] ARROW-2314:
[C++/Python] Fix union array slicing
URL: https://github.com/apache/arrow/pull/1757#discussion_r174871564
##########
File path: cpp/src/arrow/ipc/writer.cc
##########
@@ -409,7 +409,7 @@ class RecordBatchSerializer : public ArrayVisitor {
// Allocate an array of child offsets. Set all to -1 to indicate that we
// haven't observed a first occurrence of a particular child yet
- std::vector<int32_t> child_offsets(max_code + 1);
+ std::vector<int32_t> child_offsets(max_code + 1, -1);
Review comment:
Note these are unrelated logic fixes I spotted while reading this code (this
is the path for dense unions).
If desired I can separate those changes into a separate PR. In any case, it
needs validating by a reviewer.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [Python] Union array slicing is defective
> -----------------------------------------
>
> Key: ARROW-2314
> URL: https://issues.apache.org/jira/browse/ARROW-2314
> Project: Apache Arrow
> Issue Type: Bug
> Components: C++, Python
> Affects Versions: 0.8.0
> Reporter: Antoine Pitrou
> Priority: Major
> Labels: pull-request-available
>
> {code:python}
> >>> a = pa.UnionArray.from_sparse(pa.array([0,1,1], type=pa.int8()),
> >>> [pa.array(["a", "b", "c"]), pa.array([2,3,4])])
> >>> a
> <pyarrow.lib.UnionArray object at 0x7fe9381304a8>
> [
> 'a',
> 3,
> 4
> ]
> >>> a[1:]
> <pyarrow.lib.UnionArray object at 0x7fe939409598>
> [
> 2,
> 3
> ]
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)