kaoutherab commented on a change in pull request #12706:
URL: https://github.com/apache/arrow/pull/12706#discussion_r839816527
##########
File path: cpp/src/arrow/array/validate.cc
##########
@@ -509,22 +510,23 @@ struct ValidateArrayImpl {
}
if (full_validation) {
- if (data.null_count != kUnknownNullCount) {
- int64_t actual_null_count;
- if (HasValidityBitmap(data.type->id()) && data.buffers[0]) {
- // Do not call GetNullCount() as it would also set the `null_count`
member
- actual_null_count = data.length -
CountSetBits(data.buffers[0]->data(),
- data.offset,
data.length);
- } else if (data.type->storage_id() == Type::NA) {
- actual_null_count = data.length;
- } else {
- actual_null_count = 0;
- }
- if (actual_null_count != data.null_count) {
- return Status::Invalid("null_count value (", data.null_count,
- ") doesn't match actual number of nulls in
array (",
- actual_null_count, ")");
- }
+ int64_t actual_null_count;
+ if (HasValidityBitmap(data.type->id()) && data.buffers[0]) {
+ // Do not call GetNullCount() as it would also set the `null_count`
member
+ actual_null_count =
+ data.length - CountSetBits(data.buffers[0]->data(), data.offset,
data.length);
+ } else if (data.type->storage_id() == Type::NA) {
+ actual_null_count = data.length;
+ } else {
+ actual_null_count = 0;
+ }
+ if (data.null_count != kUnknownNullCount && actual_null_count !=
data.null_count) {
+ return Status::Invalid("null_count value (", data.null_count,
+ ") doesn't match actual number of nulls in
array (",
+ actual_null_count, ")");
+ }
+ if (!nullable && actual_null_count > 0) {
+ return Status::Invalid("Null found but field is not nullable");
}
}
return Status::OK();
Review comment:
This is already covered in this PR (for "ValidateListLike").
--
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]