rdblue commented on code in PR #12672:
URL: https://github.com/apache/iceberg/pull/12672#discussion_r2040249451


##########
core/src/main/java/org/apache/iceberg/ManifestFileParser.java:
##########
@@ -125,41 +113,13 @@ static ManifestFile fromJson(JsonNode jsonNode) {
 
     long sequenceNumber = JsonUtil.getLong(SEQUENCE_NUMBER, jsonNode);
     long minSequenceNumber = JsonUtil.getLong(MIN_SEQUENCE_NUMBER, jsonNode);
-
-    Long addedSnapshotId = null;
-    if (jsonNode.has(ADDED_SNAPSHOT_ID)) {
-      addedSnapshotId = JsonUtil.getLong(ADDED_SNAPSHOT_ID, jsonNode);
-    }
-
-    Integer addedFilesCount = null;
-    if (jsonNode.has(ADDED_FILES_COUNT)) {
-      addedFilesCount = JsonUtil.getInt(ADDED_FILES_COUNT, jsonNode);
-    }
-
-    Integer existingFilesCount = null;
-    if (jsonNode.has(EXISTING_FILES_COUNT)) {
-      existingFilesCount = JsonUtil.getInt(EXISTING_FILES_COUNT, jsonNode);
-    }
-
-    Integer deletedFilesCount = null;
-    if (jsonNode.has(DELETED_FILES_COUNT)) {
-      deletedFilesCount = JsonUtil.getInt(DELETED_FILES_COUNT, jsonNode);
-    }
-
-    Long addedRowsCount = null;
-    if (jsonNode.has(ADDED_ROWS_COUNT)) {
-      addedRowsCount = JsonUtil.getLong(ADDED_ROWS_COUNT, jsonNode);
-    }
-
-    Long existingRowsCount = null;
-    if (jsonNode.has(EXISTING_ROWS_COUNT)) {
-      existingRowsCount = JsonUtil.getLong(EXISTING_ROWS_COUNT, jsonNode);
-    }
-
-    Long deletedRowsCount = null;
-    if (jsonNode.has(DELETED_ROWS_COUNT)) {
-      deletedRowsCount = JsonUtil.getLong(DELETED_ROWS_COUNT, jsonNode);
-    }
+    Long addedSnapshotId = JsonUtil.getLongOrNull(ADDED_SNAPSHOT_ID, jsonNode);
+    Integer addedFilesCount = JsonUtil.getIntOrNull(ADDED_FILES_COUNT, 
jsonNode);
+    Integer existingFilesCount = JsonUtil.getIntOrNull(EXISTING_FILES_COUNT, 
jsonNode);
+    Integer deletedFilesCount = JsonUtil.getIntOrNull(DELETED_FILES_COUNT, 
jsonNode);
+    Long addedRowsCount = JsonUtil.getLongOrNull(ADDED_ROWS_COUNT, jsonNode);
+    Long existingRowsCount = JsonUtil.getLongOrNull(EXISTING_ROWS_COUNT, 
jsonNode);
+    Long deletedRowsCount = JsonUtil.getLongOrNull(DELETED_ROWS_COUNT, 
jsonNode);

Review Comment:
   These changes were needed to stay under the cyclomatic complexity limit. 
Overall I think they're good changes because they use `JsonUtil` methods that 
were added after the initial version of this parser.



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