| 711 | // a given metadata key. |
| 712 | template <typename T, typename ArrowType = typename CTypeTraits<T>::ArrowType> |
| 713 | enable_if_parameter_free<ArrowType, T> GetMetadata(const KeyValueMetadata* metadata, |
| 714 | const std::string& key, |
| 715 | T default_value) { |
| 716 | if (!metadata) return default_value; |
| 717 | const auto index = metadata->FindKey(key); |
| 718 | if (index < 0) return default_value; |
| 719 | const auto& value = metadata->value(index); |
| 720 | T output{}; |
| 721 | if (!internal::ParseValue<ArrowType>(value.data(), value.length(), &output)) { |
| 722 | ABORT_NOT_OK(Status::Invalid("Could not parse ", key, " = ", value, " as ", |
| 723 | ArrowType::type_name())); |
| 724 | } |
| 725 | return output; |
| 726 | } |
| 727 | |
| 728 | /// \brief Shuffle a list-view array in place using the Fisher–Yates algorithm [1]. |
| 729 | /// |