westonpace commented on code in PR #34416:
URL: https://github.com/apache/arrow/pull/34416#discussion_r1127022229


##########
cpp/src/arrow/adapters/orc/adapter_test.cc:
##########
@@ -840,6 +840,23 @@ TEST_F(TestORCWriterSingleArray, WriteListOfMap) {
   AssertArrayWriteReadEqual(array, array, kDefaultSmallMemStreamSize * 10);
 }
 
+TEST_F(TestORCWriterSingleArray, WriteSparseUnion) {
+  const int64_t num_rows = 1024;
+  auto type =
+      sparse_union({field("_union_0", utf8()), field("_union_1", int32())}, 
{0, 1});
+  auto array = checked_pointer_cast<SparseUnionArray>(rand.ArrayOf(type, 
num_rows, 0.4));
+  ArrayVector children;
+  for (int i = 0; i < array->num_fields(); ++i) {
+    ASSERT_OK_AND_ASSIGN(auto flattened_child, array->GetFlattenedField(i));
+    children.emplace_back(std::move(flattened_child));
+  }
+  auto flattened_array = std::make_shared<SparseUnionArray>(
+      array->type(), array->length(), std::move(children), array->type_codes(),
+      array->offset());

Review Comment:
   Can you maybe add a small comment explaining this for future readers that 
might not be as familiar with orc?



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