mapleFU commented on code in PR #34961:
URL: https://github.com/apache/arrow/pull/34961#discussion_r1164063062


##########
cpp/src/arrow/testing/random.cc:
##########
@@ -916,14 +916,14 @@ std::shared_ptr<Array> 
RandomArrayGenerator::ArrayOf(const Field& field, int64_t
 
     case Type::type::STRUCT: {
       ArrayVector child_arrays(field.type()->num_fields());
-      std::vector<std::string> field_names;
+      FieldVector child_fields;
       for (int i = 0; i < field.type()->num_fields(); i++) {
         const auto& child_field = field.type()->field(i);
         child_arrays[i] = ArrayOf(*child_field, length, alignment, 
memory_pool);
-        field_names.push_back(child_field->name());
+        child_fields.push_back(child_field);
       }
       return *StructArray::Make(
-          child_arrays, field_names,
+          child_arrays, child_fields,

Review Comment:
   `RecordBatch::ValidateFull` will validate the type of batch and it's array. 
When generate a `nonnull List<nonnull ...>`, the inner field losts it's 
`nonnull`, so though `Array::ValidateFull` may pass, the 
`RecordBatch::ValidateFull` failed



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