| 811 | } |
| 812 | |
| 813 | Status GetResult(const std::shared_ptr<Field>& field, FieldOffset* offset) { |
| 814 | RETURN_NOT_OK(VisitType(*field->type())); |
| 815 | |
| 816 | DictionaryOffset dictionary = 0; |
| 817 | const DataType* storage_type = field->type().get(); |
| 818 | if (storage_type->id() == Type::EXTENSION) { |
| 819 | storage_type = |
| 820 | checked_cast<const ExtensionType&>(*storage_type).storage_type().get(); |
| 821 | } |
| 822 | if (storage_type->id() == Type::DICTIONARY) { |
| 823 | ARROW_ASSIGN_OR_RAISE(const auto dictionary_id, |
| 824 | mapper_.GetFieldId(field_pos_.path())); |
| 825 | RETURN_NOT_OK(GetDictionaryEncoding( |
| 826 | fbb_, field, checked_cast<const DictionaryType&>(*storage_type), dictionary_id, |
| 827 | &dictionary)); |
| 828 | } |
| 829 | |
| 830 | auto metadata = field->metadata(); |
| 831 | |
| 832 | flatbuffers::Offset<KVVector> fb_custom_metadata; |
| 833 | std::vector<KeyValueOffset> key_values; |
| 834 | if (metadata != nullptr) { |
| 835 | AppendKeyValueMetadata(fbb_, *metadata, &key_values); |
| 836 | } |
| 837 | |
| 838 | for (const auto& pair : extra_type_metadata_) { |
| 839 | key_values.push_back(AppendKeyValue(fbb_, pair.first, pair.second)); |
| 840 | } |
| 841 | |
| 842 | if (key_values.size() > 0) { |
| 843 | fb_custom_metadata = fbb_.CreateVector(key_values); |
| 844 | } |
| 845 | |
| 846 | auto fb_name = fbb_.CreateString(field->name()); |
| 847 | auto fb_children = fbb_.CreateVector(children_.data(), children_.size()); |
| 848 | *offset = |
| 849 | flatbuf::CreateField(fbb_, fb_name, field->nullable(), fb_type_, type_offset_, |
| 850 | dictionary, fb_children, fb_custom_metadata); |
| 851 | return Status::OK(); |
| 852 | } |
| 853 | |
| 854 | private: |
| 855 | FBB& fbb_; |
no test coverage detected