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

Function AssertDictConversion

cpp/src/arrow/csv/converter_test.cc:122–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void 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
147template <typename DATA_TYPE, typename C_TYPE>
148void AssertConversionAllNulls(const std::shared_ptr<DataType>& type) {

Callers 2

TYPED_TESTFunction · 0.85
TESTFunction · 0.85

Calls 11

DictConversionFunction · 0.85
AssertArraysEqualFunction · 0.85
indicesMethod · 0.80
ASSERT_OK_AND_ASSIGNFunction · 0.70
DefaultsFunction · 0.50
dictionaryFunction · 0.50
typeMethod · 0.45
ValidateFullMethod · 0.45
ValidateMethod · 0.45
EqualsMethod · 0.45
dictionaryMethod · 0.45

Tested by

no test coverage detected