| 120 | } |
| 121 | |
| 122 | void AssertDictConversion(const std::string& csv_string, |
| 123 | const std::shared_ptr<Array>& expected_indices, |
| 124 | const std::shared_ptr<Array>& expected_dict, |
| 125 | int32_t max_cardinality = -1, |
| 126 | ConvertOptions options = ConvertOptions::Defaults(), |
| 127 | bool validate_full = true) { |
| 128 | std::shared_ptr<BlockParser> parser; |
| 129 | std::shared_ptr<DictionaryConverter> converter; |
| 130 | std::shared_ptr<Array> array, expected_array; |
| 131 | std::shared_ptr<DataType> expected_type; |
| 132 | |
| 133 | ASSERT_OK_AND_ASSIGN( |
| 134 | array, DictConversion(expected_dict->type(), csv_string, max_cardinality, options)); |
| 135 | if (validate_full) { |
| 136 | ASSERT_OK(array->ValidateFull()); |
| 137 | } else { |
| 138 | ASSERT_OK(array->Validate()); |
| 139 | } |
| 140 | expected_type = dictionary(expected_indices->type(), expected_dict->type()); |
| 141 | ASSERT_TRUE(array->type()->Equals(*expected_type)); |
| 142 | const auto& dict_array = internal::checked_cast<const DictionaryArray&>(*array); |
| 143 | AssertArraysEqual(*dict_array.dictionary(), *expected_dict); |
| 144 | AssertArraysEqual(*dict_array.indices(), *expected_indices); |
| 145 | } |
| 146 | |
| 147 | template <typename DATA_TYPE, typename C_TYPE> |
| 148 | void AssertConversionAllNulls(const std::shared_ptr<DataType>& type) { |
no test coverage detected