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

Function DecodeStringDictionary

cpp/src/arrow/json/test_common.h:225–241  ·  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

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