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