MCPcopy Create free account
hub / github.com/apache/arrow / TestUnionConversion

Function TestUnionConversion

cpp/src/arrow/adapters/orc/adapter_test.cc:1064–1089  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1062}
1063
1064void TestUnionConversion(std::shared_ptr<Array> array) {
1065 auto length = array->length();
1066 auto orc_type = liborc::Type::buildTypeFromString("uniontype<string,int>");
1067
1068 // Workaround for an unfortunate breaking change introduced by ORC-1.9.0.
1069 MemoryOutputStream mem_stream(/*capacity=*/1024);
1070 auto writer = CreateWriter(/*stripe_size=*/1024, *orc_type, &mem_stream);
1071 auto orc_batch = writer->createRowBatch(length);
1072 // auto orc_batch = orc_type->createRowBatch(length, *liborc::getDefaultPool());
1073
1074 // Convert from arrow to orc
1075 int arrow_chunk_offset = 0;
1076 int64_t arrow_index_offset = 0;
1077 ASSERT_OK(adapters::orc::WriteBatch(ChunkedArray{array}, length, &arrow_chunk_offset,
1078 &arrow_index_offset, orc_batch.get()));
1079
1080 // Convert from orc to arrow
1081 ASSIGN_OR_ABORT(auto array_builder, MakeBuilder(array->type()));
1082 ASSERT_OK(adapters::orc::AppendBatch(orc_type.get(), orc_batch.get(), 0, length,
1083 array_builder.get()));
1084 std::shared_ptr<Array> result;
1085 ASSERT_OK(array_builder->Finish(&result));
1086
1087 // Compare the result
1088 AssertArraysEqual(*array, *result);
1089}
1090
1091} // namespace
1092

Callers 1

TESTFunction · 0.85

Calls 7

CreateWriterFunction · 0.85
AppendBatchFunction · 0.85
AssertArraysEqualFunction · 0.85
WriteBatchFunction · 0.70
lengthMethod · 0.45
getMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected