[ https://issues.apache.org/jira/browse/ARROW-2328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16410591#comment-16410591 ]
ASF GitHub Bot commented on ARROW-2328: --------------------------------------- Adriandorr commented on a change in pull request #1766: ARROW-2328: [C++] Writing a slice with feather ignores the offset. URL: https://github.com/apache/arrow/pull/1766#discussion_r176607118 ########## File path: cpp/src/arrow/ipc/feather.cc ########## @@ -558,8 +577,18 @@ class TableWriter::TableWriterImpl : public ArrayVisitor { // byte boundary, and we write this much data into the stream int64_t null_bitmap_size = GetOutputLength(BitUtil::BytesForBits(values.length())); if (values.null_bitmap()) { - RETURN_NOT_OK(WritePadded(stream_.get(), values.null_bitmap()->data(), - null_bitmap_size, &bytes_written)); + auto null_bitmap = values.null_bitmap(); + if (values.offset() > 0) { + if (!pool_) { + return Status::Invalid( + "Require memory pol to write array slice (i.e. offset > 0) with nulls."); + } + RETURN_NOT_OK(GetTruncatedBitmap(values.offset(), values.length(), null_bitmap, + pool_, &null_bitmap)); + } + + RETURN_NOT_OK(WritePadded(stream_.get(), null_bitmap->data(), null_bitmap_size, Review comment: I've pushed a change to do as you suggested and added a test. ---------------------------------------------------------------- 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: us...@infra.apache.org > Writing a slice with feather ignores the offset > ----------------------------------------------- > > Key: ARROW-2328 > URL: https://issues.apache.org/jira/browse/ARROW-2328 > Project: Apache Arrow > Issue Type: Bug > Components: C++ > Affects Versions: 0.8.0 > Reporter: Adrian > Priority: Major > Labels: pull-request-available > Fix For: 0.10.0 > > Original Estimate: 0.5h > Remaining Estimate: 0.5h > > Writing a slice from row n of length m of an array to feather would write the > first m rows, instead of the rows starting at n. > The null bitmap also ends up misaligned. Also tested and fixed in the pull > request below. > I've created a pull request with tests and fix here: > [Pullrequest#1766|https://github.com/apache/arrow/pull/1766] > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)