bkietz commented on code in PR #38252:
URL: https://github.com/apache/arrow/pull/38252#discussion_r1424345547
##########
cpp/src/arrow/array/validate.cc:
##########
@@ -549,26 +566,32 @@ 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) {
+ if (GetNullCount() != data.null_count) {
return Status::Invalid("null_count value (", data.null_count,
") doesn't match actual number of nulls in
array (",
- actual_null_count, ")");
+ null_count, ")");
}
}
}
return Status::OK();
}
+ int64_t GetNullCount() {
+ if (null_count != kUnknownNullCount) return null_count;
+
+ if (HasValidityBitmap(data.type->id()) && data.buffers[0]) {
+ // Do not call GetNullCount() as it would also set the `null_count`
member
+ return null_count = data.length -
+ CountSetBits(data.buffers[0]->data(), data.offset,
data.length);
Review Comment:
okay
--
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]