You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2023/04/10 08:35:15 UTC

[GitHub] [arrow] mapleFU commented on a diff in pull request #34961: GH-34960: [C++] test util Fixing arrow Random Generator for lost nullable info

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


##########
cpp/src/arrow/testing/random.cc:
##########
@@ -793,7 +793,7 @@ std::shared_ptr<Array> RandomArrayGenerator::ArrayOf(const Field& field, int64_t
                 values_length, alignment, memory_pool);                              \
     const auto offsets = OffsetsFromLengthsArray(lengths.get(), force_empty_nulls,   \
                                                  alignment, memory_pool);            \
-    return *ARRAY_TYPE::FromArrays(*offsets, *values);                               \
+    return *ARRAY_TYPE::FromArrays(field.type(), *offsets, *values);                 \

Review Comment:
   No, the problem is a bit tricky. Let me explain it:
   1. Arrow has `DataType`, `DataType` doesn't including some nullable info itself. `Field` has nullable info.
   2. For `DataType` , it child would be array of `Field`, so DataType has children's nullable info
   
   Here if doesn't pass `field.type()` in ctor, it will mark child as nullable. And Map's constructor already marks it.



-- 
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: github-unsubscribe@arrow.apache.org

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