[ 
https://issues.apache.org/jira/browse/ARROW-2244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16385773#comment-16385773
 ] 

ASF GitHub Bot commented on ARROW-2244:
---------------------------------------

xhochy closed pull request #1696: ARROW-2244: [C++] Add unit test to explicitly 
check that NullArray internal data set correctly in Slice operations
URL: https://github.com/apache/arrow/pull/1696
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/cpp/src/arrow/array-test.cc b/cpp/src/arrow/array-test.cc
index 4aaf18256..c3ac08286 100644
--- a/cpp/src/arrow/array-test.cc
+++ b/cpp/src/arrow/array-test.cc
@@ -136,9 +136,15 @@ TEST_F(TestArray, SliceRecomputeNullCount) {
 
   auto arr = std::make_shared<Int32Array>(16, data, nullptr, -1);
   ASSERT_EQ(0, arr->null_count());
+}
 
+TEST_F(TestArray, NullArraySliceNullCount) {
   auto null_arr = std::make_shared<NullArray>(10);
   auto null_arr_sliced = null_arr->Slice(3, 6);
+
+  // The internal null count is 6, does not require recomputation
+  ASSERT_EQ(6, null_arr_sliced->data()->null_count);
+
   ASSERT_EQ(6, null_arr_sliced->null_count());
 }
 


 

----------------------------------------------------------------
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]


> [C++] Slicing NullArray should not cause the null count on the internal data 
> to be unknown
> ------------------------------------------------------------------------------------------
>
>                 Key: ARROW-2244
>                 URL: https://issues.apache.org/jira/browse/ARROW-2244
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++
>            Reporter: Wes McKinney
>            Assignee: Wes McKinney
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.9.0
>
>
> see https://github.com/apache/arrow/blob/master/cpp/src/arrow/array.cc#L101



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to