| 1062 | } |
| 1063 | |
| 1064 | void 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 |
no test coverage detected