| 874 | |
| 875 | template <typename DecimalValue> |
| 876 | void TestDecimalDictionaryBuilderBasic(std::shared_ptr<DataType> decimal_type) { |
| 877 | // Build the dictionary Array |
| 878 | DictionaryBuilder<FixedSizeBinaryType> builder(decimal_type); |
| 879 | |
| 880 | // Test data |
| 881 | std::vector<DecimalValue> test{12, 12, 11, 12}; |
| 882 | for (const auto& value : test) { |
| 883 | ASSERT_OK(builder.Append(value.ToBytes().data())); |
| 884 | } |
| 885 | |
| 886 | std::shared_ptr<Array> result; |
| 887 | ASSERT_OK(builder.Finish(&result)); |
| 888 | |
| 889 | // Build expected data |
| 890 | DictionaryArray expected(dictionary(int8(), decimal_type), |
| 891 | ArrayFromJSON(int8(), "[0, 0, 1, 0]"), |
| 892 | ArrayFromJSON(decimal_type, "[\"12\", \"11\"]")); |
| 893 | |
| 894 | ASSERT_TRUE(expected.Equals(result)); |
| 895 | } |
| 896 | |
| 897 | TEST(TestDecimal128DictionaryBuilder, Basic) { |
| 898 | TestDecimalDictionaryBuilderBasic<Decimal128>(arrow::decimal128(2, 0)); |
nothing calls this directly
no test coverage detected