You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/01/04 12:58:47 UTC

[GitHub] [arrow] liyafan82 commented on a change in pull request #9088: ARROW-11114: [Java] Fix Schema and Field metadata JSON serialization

liyafan82 commented on a change in pull request #9088:
URL: https://github.com/apache/arrow/pull/9088#discussion_r551302282



##########
File path: java/vector/src/main/java/org/apache/arrow/vector/types/pojo/Schema.java
##########
@@ -137,15 +138,35 @@ private Schema(@JsonProperty("fields") Iterable<Field> fields,
         .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
   }
 
+  static List<Map<String, String>> convertMetadata(Map<String, String> metadata) {
+    return (metadata == null) ? null : metadata.entrySet()
+        .stream()
+        .map(Schema::convertEntryToKeyValueMap)
+        .collect(Collectors.toList());
+  }
+
+  private static Map<String, String> convertEntryToKeyValueMap(Map.Entry<String, String> entry) {
+    Map<String, String> map = new HashMap<>(2);
+    map.put("key", entry.getKey());

Review comment:
       maybe we can extract the literals as static final variables?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org