rdblue commented on code in PR #5291:
URL: https://github.com/apache/iceberg/pull/5291#discussion_r926922790
##########
core/src/main/java/org/apache/iceberg/SchemaParser.java:
##########
@@ -183,13 +183,16 @@ private static Type typeFromJson(JsonNode json) {
return Types.fromPrimitiveString(json.asText());
} else if (json.isObject()) {
- String type = json.get(TYPE).asText();
- if (STRUCT.equals(type)) {
- return structFromJson(json);
- } else if (LIST.equals(type)) {
- return listFromJson(json);
- } else if (MAP.equals(type)) {
- return mapFromJson(json);
+ JsonNode typeObj = json.get(TYPE);
+ if (typeObj != null) {
+ String type = typeObj.asText();
+ if (STRUCT.equals(type)) {
+ return structFromJson(json);
+ } else if (LIST.equals(type)) {
+ return listFromJson(json);
+ } else if (MAP.equals(type)) {
+ return mapFromJson(json);
+ }
Review Comment:
If the type object is null, then I think we need to throw an exception,
right?
--
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]