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

Method Visit

cpp/src/arrow/ipc/dictionary.cc:303–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301 }
302
303 Status Visit(const FieldPosition& position, const std::shared_ptr<Field>& field,
304 const Array* array) {
305 const DataType* type = array->type().get();
306
307 if (type->id() == Type::EXTENSION) {
308 type = checked_cast<const ExtensionType&>(*type).storage_type().get();
309 array = checked_cast<const ExtensionArray&>(*array).storage().get();
310 }
311 if (type->id() == Type::DICTIONARY) {
312 const auto& dict_array = checked_cast<const DictionaryArray&>(*array);
313 auto dictionary = dict_array.dictionary();
314
315 // Traverse the dictionary to first gather any nested dictionaries
316 // (so that they appear in the output before their parent)
317 const auto& dict_type = checked_cast<const DictionaryType&>(*type);
318 RETURN_NOT_OK(WalkChildren(position, *dict_type.value_type(), *dictionary));
319
320 // Then record the dictionary itself
321 ARROW_ASSIGN_OR_RAISE(int64_t id, mapper_.GetFieldId(position.path()));
322 dictionaries_.emplace_back(id, dictionary);
323 } else {
324 RETURN_NOT_OK(WalkChildren(position, *type, *array));
325 }
326 return Status::OK();
327 }
328
329 Status Collect(const RecordBatch& batch) {
330 FieldPosition position;

Callers

nothing calls this directly

Calls 8

storage_typeMethod · 0.80
emplace_backMethod · 0.80
OKFunction · 0.50
getMethod · 0.45
typeMethod · 0.45
idMethod · 0.45
dictionaryMethod · 0.45
value_typeMethod · 0.45

Tested by

no test coverage detected