emkornfield commented on a change in pull request #8219:
URL: https://github.com/apache/arrow/pull/8219#discussion_r492461706



##########
File path: cpp/src/parquet/arrow/arrow_reader_writer_test.cc
##########
@@ -2360,6 +2361,49 @@ TEST(ArrowReadWrite, SingleColumnNullableStruct) {
       3);
 }
 
+TEST(ArrowReadWrite, DisagreeingValidityBitmap) {}
+
+TEST(ArrowReadWrite, NestedRequiredField) {
+  auto int_field = ::arrow::field("int_array", ::arrow::int32(), 
/*nullable=*/false);
+  auto int_array = ::arrow::ArrayFromJSON(int_field->type(), "[0, 1, 2, 3, 4, 
5, 7, 8]");
+  auto struct_field =
+      ::arrow::field("root", ::arrow::struct_({int_field}), /*nullable=*/true);
+  std::shared_ptr<Buffer> validity_bitmap;
+  ASSERT_OK_AND_ASSIGN(validity_bitmap, ::arrow::AllocateBitmap(8));
+  validity_bitmap->mutable_data()[0] = 0xCC;
+
+  auto struct_data = std::make_shared<ArrayData>(
+      struct_field->type(), /*length=*/8,
+      std::vector<std::shared_ptr<Buffer>>{validity_bitmap},
+      std::vector<std::shared_ptr<ArrayData>>{int_array->data()});
+  CheckSimpleRoundtrip(
+      ::arrow::Table::Make(
+          ::arrow::schema({struct_field}),
+          
{std::make_shared<::arrow::ChunkedArray>(::arrow::MakeArray(struct_data))}),
+      /*row_group_size=*/8);
+}
+
+TEST(ArrowReadWrite, NestedNullableField) {
+  auto int_field = ::arrow::field("int_array", ::arrow::int32());
+  auto int_array = ::arrow::ArrayFromJSON(int_field->type(), "[0, null, 2, 
null, 4, 5, null, 8]");
+  auto struct_field =
+      ::arrow::field("root", ::arrow::struct_({int_field}), /*nullable=*/true);
+  std::shared_ptr<Buffer> validity_bitmap;
+  ASSERT_OK_AND_ASSIGN(validity_bitmap, ::arrow::AllocateBitmap(8));
+  validity_bitmap->mutable_data()[0] = 0xCC;
+
+  auto struct_data = std::make_shared<ArrayData>(
+      struct_field->type(), /*length=*/8,
+      std::vector<std::shared_ptr<Buffer>>{validity_bitmap},
+      std::vector<std::shared_ptr<ArrayData>>{int_array->data()});

Review comment:
       thanks, I somehow keep forgetting this.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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


Reply via email to