rdblue commented on a change in pull request #4037:
URL: https://github.com/apache/iceberg/pull/4037#discussion_r810547312



##########
File path: core/src/main/java/org/apache/iceberg/util/JsonUtil.java
##########
@@ -129,6 +130,42 @@ public static String getStringOrNull(String property, 
JsonNode node) {
     return builder.build();
   }
 
+  public static Map<String, String> getStringMapOrNull(String property, 
JsonNode node) {
+    if (!node.has(property)) {
+      return null;
+    }
+
+    JsonNode pNode = node.get(property);
+    if (pNode == null || pNode.isNull()) {
+      return null;
+    }
+
+    Preconditions.checkArgument(pNode.isObject(),
+        "Cannot parse %s from non-object value: %s", property, pNode);

Review comment:
       I would move this check into the `buildStringMap...` method, since that 
method requires the node is an object.




-- 
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: issues-unsubscr...@iceberg.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to