bkietz commented on code in PR #38252:
URL: https://github.com/apache/arrow/pull/38252#discussion_r1424349490
##########
cpp/src/arrow/array/array_test.cc:
##########
@@ -499,6 +501,24 @@ TEST_F(TestArray, TestMakeArrayOfNull) {
}
}
}
+
+ for (int64_t length : {0, 16}) {
+ ARROW_SCOPED_TRACE("length = ", length, " (required fields)");
+
+ auto req = [](auto type) { return field("", std::move(type),
/*nullable=*/false); };
+
+ // union with no nullable fields cannot represent a null
+ ASSERT_RAISES(Invalid, MakeArrayOfNull(dense_union({req(int8())}),
length));
+
+ // struct with no nullable fields has a top level bitmap and can mask them
+ ASSERT_OK_AND_ASSIGN(auto s, MakeArrayOfNull(struct_({req(int8())}),
length));
+ ASSERT_OK(s->ValidateFull());
+
+ // dictionary with non-nullable indices can use a 1-long dict of null
+ ASSERT_OK_AND_ASSIGN(
+ s, MakeArrayOfNull(struct_({req(dictionary(int8(), int8()))}),
length));
+ ASSERT_OK(s->ValidateFull());
Review Comment:
will do
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]