You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/06/19 15:37:09 UTC

arrow git commit: ARROW-1081: Fill null_bitmap correctly in TestBase

Repository: arrow
Updated Branches:
  refs/heads/master 5be05ac15 -> d874d4e32


ARROW-1081: Fill null_bitmap correctly in TestBase

Change-Id: I103cc31e1400491713b160b429c5491e8c82f810

Author: Uwe L. Korn <uw...@xhochy.com>

Closes #760 from xhochy/ARROW-1081 and squashes the following commits:

e012438 [Uwe L. Korn] ARROW-1081: Fill null_bitmap correctly in TestBase


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/d874d4e3
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/d874d4e3
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/d874d4e3

Branch: refs/heads/master
Commit: d874d4e32707f249ce64e21f4694c95ff3a40a82
Parents: 5be05ac
Author: Uwe L. Korn <uw...@xhochy.com>
Authored: Mon Jun 19 11:37:02 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Mon Jun 19 11:37:02 2017 -0400

----------------------------------------------------------------------
 cpp/src/arrow/test-common.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/d874d4e3/cpp/src/arrow/test-common.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/test-common.h b/cpp/src/arrow/test-common.h
index dc11e76..b3e5af8 100644
--- a/cpp/src/arrow/test-common.h
+++ b/cpp/src/arrow/test-common.h
@@ -52,7 +52,12 @@ class TestBase : public ::testing::Test {
     test::random_bytes(data_nbytes, random_seed_++, data->mutable_data());
 
     auto null_bitmap = std::make_shared<PoolBuffer>(pool_);
-    EXPECT_OK(null_bitmap->Resize(BitUtil::BytesForBits(length)));
+    const int64_t null_nbytes = BitUtil::BytesForBits(length);
+    EXPECT_OK(null_bitmap->Resize(null_nbytes));
+    memset(null_bitmap->mutable_data(), 255, null_nbytes);
+    for (int64_t i = 0; i < null_count; i++) {
+      BitUtil::ClearBit(null_bitmap->mutable_data(), i * (length / null_count));
+    }
     return std::make_shared<ArrayType>(length, data, null_bitmap, null_count);
   }