| 487 | |
| 488 | template <typename BuilderType> |
| 489 | void TestStringDictionaryMakeBuilder(const std::shared_ptr<DataType>& value_type) { |
| 490 | auto dict_array = ArrayFromJSON(value_type, R"(["test", "test2"])"); |
| 491 | auto dict_type = dictionary(int8(), value_type); |
| 492 | auto int_array = ArrayFromJSON(int8(), "[0, 1, 0]"); |
| 493 | std::unique_ptr<ArrayBuilder> boxed_builder; |
| 494 | ASSERT_OK(MakeBuilder(default_memory_pool(), dict_type, &boxed_builder)); |
| 495 | auto& builder = checked_cast<BuilderType&>(*boxed_builder); |
| 496 | |
| 497 | // Build the dictionary Array |
| 498 | ASSERT_OK(builder.Append("test")); |
| 499 | ASSERT_OK(builder.Append("test2")); |
| 500 | ASSERT_OK(builder.Append("test")); |
| 501 | |
| 502 | std::shared_ptr<Array> result; |
| 503 | ASSERT_OK(builder.Finish(&result)); |
| 504 | |
| 505 | // Build expected data |
| 506 | DictionaryArray expected(dict_type, int_array, dict_array); |
| 507 | |
| 508 | AssertArraysEqual(expected, *result); |
| 509 | } |
| 510 | |
| 511 | TEST(TestStringDictionaryBuilder, MakeBuilder) { |
| 512 | TestStringDictionaryMakeBuilder<DictionaryBuilder<StringType>>(utf8()); |
nothing calls this directly
no test coverage detected