pvary commented on code in PR #14398:
URL: https://github.com/apache/iceberg/pull/14398#discussion_r2541376934
##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -458,20 +586,39 @@ public Table loadTable(SessionContext context,
TableIdentifier identifier) {
tableMetadata,
endpoints);
- trackFileIO(ops);
-
BaseTable table =
new BaseTable(
ops,
fullTableName(finalIdentifier),
metricsReporter(paths.metrics(finalIdentifier), tableClient));
+
+ String eTag = responseHeaders.getOrDefault(HttpHeaders.ETAG, null);
+ if (eTag != null) {
+ BaseTable clonedTable = cloneTable(table);
+
+ trackFileIO((RESTTableOperations) clonedTable.operations());
+
+ tableCache.put(
+ SessionIDTableID.of(context.sessionId(), finalIdentifier),
+ TableWithETag.of(clonedTable, eTag));
+ } else {
+ trackFileIO(ops);
+ }
+
if (metadataType != null) {
return MetadataTableUtils.createMetadataTableInstance(table,
metadataType);
}
return table;
}
+ private BaseTable cloneTable(BaseTable originalTable) {
Review Comment:
Is the comment long enough to merit a javadoc?
--
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]