krvikash commented on code in PR #6512:
URL: https://github.com/apache/iceberg/pull/6512#discussion_r1065101723


##########
core/src/main/java/org/apache/iceberg/jdbc/JdbcTableOperations.java:
##########
@@ -146,6 +149,21 @@ public void doCommit(TableMetadata base, TableMetadata 
metadata) {
     }
   }
 
+  private Optional<String> getExistingMetadataLocation(TableMetadata base, 
TableMetadata metadata) {

Review Comment:
   Yes, You are right. without this change also register table will work. But 
the `registerTable` will create a new metadata JSON file and register the 
table. That is why this handling ensures if `registerTable` call `doCommit` 
then don't create a new metadata file and rather use the existing one.
   
   Currently we are handling the same logic in `HiveTableOperations` and 
`NessieTableOperations`. But other table operations are missing this part.
   
   
https://github.com/apache/iceberg/blob/6b8f7e0e31a81029b478e7757aba749f5ed27f42/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java#L249-L252
   
   
https://github.com/apache/iceberg/blob/ede085d0f7529f24acd0c81dd0a43f7bb969b763/nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java#L146-L149
   
   
    
   Coming to `getExistingMetadataLocation`, I am setting `metadataFileLocation` 
in the meadata properties in `RESTSessionCatalog` whereas for `JdbcCatalog` it 
uses `BaseMetastoreCatalog` implementation where `metadata` with existing 
`metadataFileLocation` is passed through table operations. 



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

Reply via email to