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

Function DecodeStringDictionary

cpp/src/arrow/json/test_common.h:227–243  ·  view source on GitHub ↗

scalar values (numbers and strings) are parsed into a dictionary . This can be decoded for ease of comparison

Source from the content-addressed store, hash-verified

225// scalar values (numbers and strings) are parsed into a
226// dictionary<index:int32, value:string>. This can be decoded for ease of comparison
227inline static Status DecodeStringDictionary(const DictionaryArray& dict_array,
228 std::shared_ptr<Array>* decoded) {
229 const StringArray& dict = checked_cast<const StringArray&>(*dict_array.dictionary());
230 const Int32Array& indices = checked_cast<const Int32Array&>(*dict_array.indices());
231 StringBuilder builder;
232 RETURN_NOT_OK(builder.Resize(indices.length()));
233 for (int64_t i = 0; i < indices.length(); ++i) {
234 if (indices.IsNull(i)) {
235 builder.UnsafeAppendNull();
236 continue;
237 }
238 auto value = dict.GetView(indices.GetView(i));
239 RETURN_NOT_OK(builder.ReserveData(value.size()));
240 builder.UnsafeAppend(value);
241 }
242 return builder.Finish(decoded);
243}
244
245inline static Status ParseFromString(ParseOptions options, string_view src_str,
246 std::shared_ptr<Array>* parsed) {

Callers 1

Calls 11

indicesMethod · 0.80
dictionaryMethod · 0.45
ResizeMethod · 0.45
lengthMethod · 0.45
IsNullMethod · 0.45
UnsafeAppendNullMethod · 0.45
GetViewMethod · 0.45
ReserveDataMethod · 0.45
sizeMethod · 0.45
UnsafeAppendMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected