deniskuzZ commented on code in PR #5136:
URL: https://github.com/apache/hive/pull/5136#discussion_r1539384010
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -1611,7 +1612,68 @@ public SnapshotContext
getCurrentSnapshotContext(org.apache.hadoop.hive.ql.metad
if (current == null) {
return null;
}
- return new SnapshotContext(current.snapshotId());
+ return toSnapshotContext(current);
+ }
+
+ private SnapshotContext toSnapshotContext(Snapshot snapshot) {
+ Map<String, String> summaryMap = snapshot.summary();
+ long addedRecords = getLongSummary(summaryMap,
SnapshotSummary.ADDED_RECORDS_PROP);
+ long deletedRecords = getLongSummary(summaryMap,
SnapshotSummary.DELETED_RECORDS_PROP);
+ return new SnapshotContext(
+ snapshot.snapshotId(), toWriteOperationType(snapshot.operation()),
addedRecords, deletedRecords);
+ }
+
+ private SnapshotContext.WriteOperationType toWriteOperationType(String
operation) {
+ if (DataOperations.APPEND.equals(operation)) {
Review Comment:
can't we do
````
try {
SnapshotContext.WriteOperationType.valueOf(DataOperations.APPEND.toUpperCase())
} catch(NullPointerExcepttion | IllegalArgumentException ex) {...}
````
--
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]