This is an automated email from the ASF dual-hosted git repository.
wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 8cfa51a ARROW-2790: [C++] Minor style changes from the review
8cfa51a is described below
commit 8cfa51a1563cd9722ffeb8ec92c60d477d12ae8c
Author: Dimitri Vorona <[email protected]>
AuthorDate: Mon Jul 9 12:48:58 2018 -0400
ARROW-2790: [C++] Minor style changes from the review
These are just a couple of changes which were left out out of the commit
which closed PR #2216.
Author: Dimitri Vorona <[email protected]>
Closes #2232 from alendit/pr2216addendum and squashes the following commits:
a8d7e9c4 <Dimitri Vorona> Minor style changes from the review
---
cpp/src/arrow/array-test.cc | 18 +++++++++---------
cpp/src/arrow/builder.h | 3 +--
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/cpp/src/arrow/array-test.cc b/cpp/src/arrow/array-test.cc
index 1bef773..589f149 100644
--- a/cpp/src/arrow/array-test.cc
+++ b/cpp/src/arrow/array-test.cc
@@ -507,15 +507,15 @@ TYPED_TEST(TestPrimitiveBuilder, TestAppendNull) {
TYPED_TEST(TestPrimitiveBuilder, TestAppendNulls) {
const int64_t size = 10;
- const uint8_t nullmap[10] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
+ const uint8_t valid_bytes[10] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
- ASSERT_OK(this->builder_->AppendNulls(nullmap, size));
+ ASSERT_OK(this->builder_->AppendNulls(valid_bytes, size));
std::shared_ptr<Array> result;
FinishAndCheckPadding(this->builder_.get(), &result);
for (int64_t i = 0; i < size; ++i) {
- ASSERT_EQ(result->IsValid(i), static_cast<bool>(nullmap[i]));
+ ASSERT_EQ(result->IsValid(i), static_cast<bool>(valid_bytes[i]));
}
}
@@ -1829,13 +1829,13 @@ TEST_F(TestAdaptiveIntBuilder, TestAppendNull) {
TEST_F(TestAdaptiveIntBuilder, TestAppendNulls) {
constexpr int64_t size = 10;
- const uint8_t nullmap[size] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
- ASSERT_OK(builder_->AppendNulls(nullmap, size));
+ const uint8_t valid_bytes[size] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
+ ASSERT_OK(builder_->AppendNulls(valid_bytes, size));
Done();
for (unsigned index = 0; index < size; ++index) {
- ASSERT_EQ(result_->IsValid(index), static_cast<bool>(nullmap[index]));
+ ASSERT_EQ(result_->IsValid(index), static_cast<bool>(valid_bytes[index]));
}
}
@@ -1956,13 +1956,13 @@ TEST_F(TestAdaptiveUIntBuilder, TestAppendNull) {
TEST_F(TestAdaptiveUIntBuilder, TestAppendNulls) {
constexpr int64_t size = 10;
- const uint8_t nullmap[size] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
- ASSERT_OK(builder_->AppendNulls(nullmap, size));
+ const uint8_t valid_bytes[size] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
+ ASSERT_OK(builder_->AppendNulls(valid_bytes, size));
Done();
for (unsigned index = 0; index < size; ++index) {
- ASSERT_EQ(result_->IsValid(index), static_cast<bool>(nullmap[index]));
+ ASSERT_EQ(result_->IsValid(index), static_cast<bool>(valid_bytes[index]));
}
}
diff --git a/cpp/src/arrow/builder.h b/cpp/src/arrow/builder.h
index b22f126..3753923 100644
--- a/cpp/src/arrow/builder.h
+++ b/cpp/src/arrow/builder.h
@@ -209,8 +209,7 @@ class ARROW_EXPORT PrimitiveBuilder : public ArrayBuilder {
Status AppendNull() {
RETURN_NOT_OK(Reserve(1));
- memset(raw_data_ + length_, 0,
- static_cast<size_t>(TypeTraits<Type>::bytes_required(1)));
+ memset(raw_data_ + length_, 0, sizeof(value_type));
UnsafeAppendToBitmap(false);
return Status::OK();
}