tianchen92 commented on a change in pull request #7887:
URL: https://github.com/apache/arrow/pull/7887#discussion_r484177957



##########
File path: cpp/src/arrow/pretty_print.cc
##########
@@ -339,6 +339,17 @@ class ArrayPrinter : public PrettyPrinter {
     children.reserve(array.num_fields());
     for (int i = 0; i < array.num_fields(); ++i) {
       children.emplace_back(array.field(i));
+      // set field array null at index which parent struct is null,
+      // because StructBuilder#AppendNull dosen't set child null bitmap.
+      auto field_null_buf = array.field(i)->null_bitmap();
+      if (field_null_buf != nullptr) {
+        uint8_t* field_null_data = field_null_buf->mutable_data();

Review comment:
       Thanks for review, I have some questions, correct me if I am wrong:
   1 now seems AppendNull/AppendNulls set null bitmap and append empty value 
using data_builder_, if AppendEmpty/AppendEmpties also do this, what is the 
difference between this two API?
   2 From http://arrow.apache.org/docs/format/Columnar.html#struct-layout that 
there is no need for the child arrays to be null when the top-level struct slot 
is null, so I thought only 'empty' value should be appended (without setting 
null bitmap)。So in PrettyPrint, we need to change child null bitmap to ensure 
the correct output.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to