kbendick commented on a change in pull request #4037:
URL: https://github.com/apache/iceberg/pull/4037#discussion_r811439833
##########
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:
The idea was to leave `buildStringMap...` with no precodition checks,
and then have the individual `getStringMap` and `getStringMapOrNull` call out
to that function after doing their preconditions check.
I left the current implementation of `getStringMap` as is to minimize the
diff, but I can either:
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]