Blob Blame History Raw
--- apache-arrow-15.0.2/cpp/src/arrow/util/key_value_metadata.h.orig	2024-03-13 09:37:59.000000000 -0400
+++ apache-arrow-15.0.2/cpp/src/arrow/util/key_value_metadata.h	2024-03-20 08:02:01.157830922 -0400
@@ -20,7 +20,6 @@
 #include <cstdint>
 #include <memory>
 #include <string>
-#include <string_view>
 #include <unordered_map>
 #include <utility>
 #include <vector>
@@ -45,13 +44,13 @@
   void ToUnorderedMap(std::unordered_map<std::string, std::string>* out) const;
   void Append(std::string key, std::string value);
 
-  Result<std::string> Get(std::string_view key) const;
-  bool Contains(std::string_view key) const;
+  Result<std::string> Get(const std::string& key) const;
+  bool Contains(const std::string& key) const;
   // Note that deleting may invalidate known indices
-  Status Delete(std::string_view key);
+  Status Delete(const std::string& key);
   Status Delete(int64_t index);
   Status DeleteMany(std::vector<int64_t> indices);
-  Status Set(std::string key, std::string value);
+  Status Set(const std::string& key, const std::string& value);
 
   void reserve(int64_t n);
 
@@ -64,7 +63,7 @@
   std::vector<std::pair<std::string, std::string>> sorted_pairs() const;
 
   /// \brief Perform linear search for key, returning -1 if not found
-  int FindKey(std::string_view key) const;
+  int FindKey(const std::string& key) const;
 
   std::shared_ptr<KeyValueMetadata> Copy() const;
 
--- apache-arrow-15.0.2/cpp/src/arrow/util/key_value_metadata.cc.orig	2024-03-13 09:37:59.000000000 -0400
+++ apache-arrow-15.0.2/cpp/src/arrow/util/key_value_metadata.cc	2024-03-20 08:02:01.156830941 -0400
@@ -90,7 +90,7 @@
   values_.push_back(std::move(value));
 }
 
-Result<std::string> KeyValueMetadata::Get(std::string_view key) const {
+Result<std::string> KeyValueMetadata::Get(const std::string& key) const {
   auto index = FindKey(key);
   if (index < 0) {
     return Status::KeyError(key);
@@ -129,7 +129,7 @@
   return Status::OK();
 }
 
-Status KeyValueMetadata::Delete(std::string_view key) {
+Status KeyValueMetadata::Delete(const std::string& key) {
   auto index = FindKey(key);
   if (index < 0) {
     return Status::KeyError(key);
@@ -138,18 +138,20 @@
   }
 }
 
-Status KeyValueMetadata::Set(std::string key, std::string value) {
+Status KeyValueMetadata::Set(const std::string& key, const std::string& value) {
   auto index = FindKey(key);
   if (index < 0) {
-    Append(std::move(key), std::move(value));
+    Append(key, value);
   } else {
-    keys_[index] = std::move(key);
-    values_[index] = std::move(value);
+    keys_[index] = key;
+    values_[index] = value;
   }
   return Status::OK();
 }
 
-bool KeyValueMetadata::Contains(std::string_view key) const { return FindKey(key) >= 0; }
+bool KeyValueMetadata::Contains(const std::string& key) const {
+  return FindKey(key) >= 0;
+}
 
 void KeyValueMetadata::reserve(int64_t n) {
   DCHECK_GE(n, 0);
@@ -186,7 +188,7 @@
   return pairs;
 }
 
-int KeyValueMetadata::FindKey(std::string_view key) const {
+int KeyValueMetadata::FindKey(const std::string& key) const {
   for (size_t i = 0; i < keys_.size(); ++i) {
     if (keys_[i] == key) {
       return static_cast<int>(i);