kou commented on code in PR #38524:
URL: https://github.com/apache/arrow/pull/38524#discussion_r1382687660


##########
cpp/src/arrow/filesystem/azurefs.cc:
##########
@@ -150,13 +151,148 @@ Status ErrorToStatus(const std::string& prefix,
   return Status::IOError(prefix, " Azure Error: ", exception.what());
 }
 
-template <typename ObjectResult>
-std::shared_ptr<const KeyValueMetadata> GetObjectMetadata(const ObjectResult& 
result) {
-  auto md = std::make_shared<KeyValueMetadata>();
-  for (auto prop : result) {
-    md->Append(prop.first, prop.second);
+template <typename ArrowType>
+std::string FormatValue(typename TypeTraits<ArrowType>::CType value) {
+  struct StringAppender {
+    std::string string;
+    Status operator()(std::string_view view) {
+      string.append(view.data(), view.size());
+      return Status::OK();
+    }
+  } appender;
+  arrow::internal::StringFormatter<ArrowType> formatter;
+  ARROW_UNUSED(formatter(value, appender));
+  return appender.string;
+}
+
+std::shared_ptr<const KeyValueMetadata> PropertiesToMetadata(
+    const Azure::Storage::Blobs::Models::BlobProperties& properties) {
+  auto metadata = std::make_shared<KeyValueMetadata>();
+  // Not supported yet:
+  // * properties.ObjectReplicationSourceProperties
+  // * properties.Metadata
+  //
+  // They may have the same key defined in the following
+  // metadata->Append() list. If we have duplicated key in metadata,
+  // the first value may be only used by users because
+  // KeyValueMetadata::Get() returns the first found value. Note that
+  // users can use all values by using KeyValueMetadata::keys() and
+  // KeyValueMetadata::values().
+  if (properties.ImmutabilityPolicy.HasValue()) {
+    metadata->Append("Immutability-Policy-Expires-On",
+                     
properties.ImmutabilityPolicy.Value().ExpiresOn.ToString());
+    metadata->Append("Immutability-Policy-Mode",
+                     
properties.ImmutabilityPolicy.Value().PolicyMode.ToString());
+  }
+  metadata->Append("Content-Type", properties.HttpHeaders.ContentType);
+  metadata->Append("Content-Encoding", properties.HttpHeaders.ContentEncoding);
+  metadata->Append("Content-Language", properties.HttpHeaders.ContentEncoding);

Review Comment:
   ```suggestion
     metadata->Append("Content-Encoding", 
properties.HttpHeaders.ContentEncoding);
     metadata->Append("Content-Language", 
properties.HttpHeaders.ContentLanguage);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to