pitrou commented on code in PR #38252:
URL: https://github.com/apache/arrow/pull/38252#discussion_r1363926105


##########
cpp/src/arrow/array/validate.cc:
##########
@@ -440,9 +422,28 @@ struct ValidateArrayImpl {
     return data.buffers[index] != nullptr && data.buffers[index]->address() != 
0;
   }
 
-  Status RecurseInto(const ArrayData& related_data) {
-    ValidateArrayImpl impl{related_data, full_validation};
-    return impl.Validate();
+  template <typename... FieldDescription>
+  Status RecurseIntoField(int field_index, const FieldDescription&... 
description) {
+    const auto& related_data = *data.child_data[field_index];
+
+    if (!data.type->storage_type_ref().field(field_index)->nullable()) {
+      if (related_data.null_count != 0 && related_data.null_count != 
kUnknownNullCount) {

Review Comment:
   You could perhaps cache computed null count inside this struct?



##########
cpp/src/arrow/array/validate.cc:
##########
@@ -440,9 +422,28 @@ struct ValidateArrayImpl {
     return data.buffers[index] != nullptr && data.buffers[index]->address() != 
0;
   }
 
-  Status RecurseInto(const ArrayData& related_data) {
-    ValidateArrayImpl impl{related_data, full_validation};
-    return impl.Validate();
+  template <typename... FieldDescription>
+  Status RecurseIntoField(int field_index, const FieldDescription&... 
description) {
+    const auto& related_data = *data.child_data[field_index];
+
+    if (!data.type->storage_type_ref().field(field_index)->nullable()) {
+      if (related_data.null_count != 0 && related_data.null_count != 
kUnknownNullCount) {

Review Comment:
   You could perhaps cache the computed null count inside this struct?



-- 
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]

Reply via email to