You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/04/26 15:29:41 UTC

[GitHub] [iceberg] snazy commented on a diff in pull request #4594: Bump Nessie to 0.28.0, improve commit conflict detection

snazy commented on code in PR #4594:
URL: https://github.com/apache/iceberg/pull/4594#discussion_r858862164


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java:
##########
@@ -75,21 +87,27 @@ protected String tableName() {
     return key.toString();
   }
 
-  @Override
-  protected void refreshFromMetadataLocation(String newLocation, Predicate<Exception> shouldRetry, int numRetries) {
-    super.refreshFromMetadataLocation(newLocation, shouldRetry, numRetries, this::loadTableMetadata);
-  }
-
-  private TableMetadata loadTableMetadata(String metadataLocation) {
+  private TableMetadata loadTableMetadata(String metadataLocation, Reference reference) {
     // Update the TableMetadata with the Content of NessieTableState.
-    TableMetadata.Builder builder = TableMetadata.buildFrom(TableMetadataParser.read(io(), metadataLocation))
+    TableMetadata deserialized;
+    if (table.getMetadata() != null) {
+      deserialized = TableMetadataParser.fromJson(io(), metadataLocation, table.getMetadata().getMetadata());

Review Comment:
   (Not yet, but in the future, yes.)
   
   It's already a JSON node tree (as a generic `JsonNode`) - so the text->nodes parsing already happened.
   As I didn't want to serialize the `JsonNode` to a `String` to get a `TableMetadata`, I've updated the `TableMetadataParser`.



##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java:
##########
@@ -75,21 +87,27 @@ protected String tableName() {
     return key.toString();
   }
 
-  @Override
-  protected void refreshFromMetadataLocation(String newLocation, Predicate<Exception> shouldRetry, int numRetries) {
-    super.refreshFromMetadataLocation(newLocation, shouldRetry, numRetries, this::loadTableMetadata);
-  }
-
-  private TableMetadata loadTableMetadata(String metadataLocation) {
+  private TableMetadata loadTableMetadata(String metadataLocation, Reference reference) {
     // Update the TableMetadata with the Content of NessieTableState.
-    TableMetadata.Builder builder = TableMetadata.buildFrom(TableMetadataParser.read(io(), metadataLocation))
+    TableMetadata deserialized;
+    if (table.getMetadata() != null) {
+      deserialized = TableMetadataParser.fromJson(io(), metadataLocation, table.getMetadata().getMetadata());
+    } else {
+      deserialized = TableMetadataParser.read(io(), metadataLocation);

Review Comment:
   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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org