| 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; |
nothing calls this directly
no test coverage detected