rdblue commented on a change in pull request #4099:
URL: https://github.com/apache/iceberg/pull/4099#discussion_r805404106



##########
File path: aws/src/main/java/org/apache/iceberg/aws/glue/GlueCatalog.java
##########
@@ -431,6 +433,39 @@ protected boolean isValidIdentifier(TableIdentifier 
tableIdentifier) {
         IcebergToGlueConverter.isValidTableName(tableIdentifier.name());
   }
 
+  @Override
+  public org.apache.iceberg.Table registerTable(TableIdentifier identifier, 
String metadataFileLocation) {

Review comment:
       Is it possible to do this more generically in `BaseMetastoreCatalog` 
similar to a regular `create`?
   
   ```java
       public Table registerTable(TableIdentifier identifier, String 
metadataFileLocation) {
         TableOperations ops = newTableOps(identifier);
         if (ops.current() != null) {
           throw new AlreadyExistsException("Table already exists: %s", 
identifier);
         }
   
         FileIO io = ops.io();
         TableMetadata metadata = TableMetadataParser.read(io, 
metadataFileLocation);
   
         try {
           ops.temp(metadata).commit(null, metadata);
         } catch (CommitFailedException ignored) {
           throw new AlreadyExistsException("Table was created concurrently: 
%s", identifier);
         }
   
         return new BaseTable(ops, fullTableName(name(), identifier));
       }
   ```
   
   That will rewrite the metadata file rather than using it directly, but it 
seems like it would work in most cases.




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