rdblue commented on a change in pull request #74: Add snapshot summary and
operation.
URL: https://github.com/apache/incubator-iceberg/pull/74#discussion_r253946672
##########
File path: core/src/main/java/com/netflix/iceberg/SnapshotUpdate.java
##########
@@ -273,4 +328,31 @@ private static ManifestFile addMetadata(TableOperations
ops, ManifestFile manife
throw new RuntimeIOException(e, "Failed to read manifest: %s",
manifest.path());
}
}
+
+ private static void updateTotal(ImmutableMap.Builder<String, String>
summaryBuilder,
+ Map<String, String> previousSummary, String
totalProperty,
+ Map<String, String> currentSummary,
+ String addedProperty, String
deletedProperty) {
+ String totalStr = previousSummary.get(totalProperty);
+ if (totalStr != null) {
+ try {
+ long newTotal = Long.parseLong(totalStr);
+
+ String addedStr = currentSummary.get(addedProperty);
+ if (addedStr != null) {
+ newTotal += Long.parseLong(addedStr);
+ }
+
+ String deletedStr = currentSummary.get(deletedProperty);
+ if (deletedStr != null) {
+ newTotal -= Long.parseLong(deletedStr);
+ }
+
+ summaryBuilder.put(totalProperty, String.valueOf(newTotal));
+
+ } catch (NumberFormatException e) {
+ // ignore and do not add total
Review comment:
Yes, a log message would be useful here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]