Skip to content

Commit 12d9321

Browse files
Arkur745kou
andcommitted
Apply suggestions from code review
Co-authored-by: Sutou Kouhei <[email protected]>
1 parent a48b6f9 commit 12d9321

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

cpp/src/arrow/array/array_struct_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ TEST(TestFieldRef, GetChildren) {
751751
TEST(TestStructBuilderUnsafe, UnsafeAppend) {
752752
auto int_type = int32();
753753
auto str_type = utf8();
754-
auto struct_type = struct_({field("a", int_type), field("b", str_type)});
754+
auto struct_type = struct_({field("int", int_type), field("str", str_type)});
755755
auto pool = default_memory_pool();
756756
std::shared_ptr<Array> final_array;
757757
auto int_builder = std::make_shared<Int32Builder>(pool);
@@ -768,13 +768,13 @@ TEST(TestStructBuilderUnsafe, UnsafeAppend) {
768768
ASSERT_OK(int_builder->Append(2));
769769
ASSERT_OK(str_builder->Append("arrow"));
770770

771-
ASSERT_OK(builder.Finish(&final_array));
771+
ASSERT_OK_AND_ASSIGN(auto final_array, builder.Finish());
772772
ASSERT_EQ(2, final_array->length());
773773
ASSERT_EQ(0, final_array->null_count());
774-
auto expected_json = R"([{"a": 1, "b": "hello"}, {"a": 2, "b": "arrow"}])";
775774

775+
auto expected_json = R"([{"a": 1, "b": "hello"}, {"a": 2, "b": "arrow"}])";
776776
auto expected_array = ArrayFromJSON(struct_type, expected_json);
777-
AssertArraysEqual(*final_array, *expected_array);
777+
AssertArraysEqual(*expected_array, *final_array);
778778
}
779779

780780
TEST(TestStructBuilderUnsafe, UnsafeAppendNull) {

cpp/src/arrow/array/builder_nested.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,13 +814,10 @@ class ARROW_EXPORT StructBuilder : public ArrayBuilder {
814814
/// builders to maintain a consistent state.
815815
/// param length The number of null slots to append.
816816
Status UnsafeAppendNulls(int64_t length) {
817-
for (int64_t i = 0; i < length; ++i) {
818-
UnsafeAppend(false);
819-
}
820-
821817
for (const auto& child : children_) {
822818
ARROW_RETURN_NOT_OK(child->AppendEmptyValues(length));
823819
}
820+
UnsafeAppendToBitmap(length, false);
824821
return Status::OK();
825822
}
826823

0 commit comments

Comments
 (0)