MashrafeeAryan commented on code in PR #55348:
URL: https://github.com/apache/arrow/pull/55348#discussion_r4608469338


##########
cpp/src/parquet/arrow/writer.cc:
##########
@@ -281,6 +431,14 @@ class ArrowColumnWriterV2 {
       // The chunk offset here will be 0 except for possibly the first chunk
       // because of the advancing logic above
       std::shared_ptr<Array> array_to_write = chunk.Slice(chunk_offset, 
chunk_write_size);
+      if (root_field != nullptr) {
+        ARROW_ASSIGN_OR_RAISE(
+            std::shared_ptr<ArrayData> prepared,
+            MakeFiniteVectorElementsRequired(array_to_write->data(), 
*root_field));

Review Comment:
   If we don’t have any `FINITE_VECTOR` fields, can we skip this helper? We 
could check the schema once before the chunk loop. If there are no finite 
vectors, we can skip the helper instead of having it walk the nested arrays in 
every chunk.
   
   I am sure how much time this would save. Could we benchmark it?



##########
cpp/src/parquet/schema.cc:
##########
@@ -364,6 +423,10 @@ GroupNode::GroupNode(const std::string& name, 
Repetition::type repetition,
     field->SetParent(this);

Review Comment:
   We are  setting the new group as the child’s parent with 
`field->SetParent(this)` before checking if the group is valid. If 
`CheckFiniteVectorStructure` throws an error, the parent group goes away. Then 
the child now points to a parent that no longer exists.  I believe if we move 
the check before setting the parent, it would be great



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