rdblue commented on a change in pull request #253: [WIP] Register existing 
tables in Iceberg HiveCatalog
URL: https://github.com/apache/incubator-iceberg/pull/253#discussion_r300879999
 
 

 ##########
 File path: hive/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
 ##########
 @@ -112,6 +116,15 @@ public void renameTable(TableIdentifier from, 
TableIdentifier to) {
     }
   }
 
+  @Override
+  public org.apache.iceberg.Table registerTable(TableIdentifier identifier, 
String metadataFileLocation) {
+    TableOperations ops = newTableOps(conf(), identifier);
+    HadoopInputFile metadataFile = 
HadoopInputFile.fromLocation(metadataFileLocation, conf());
+    TableMetadata metadata = TableMetadataParser.read(ops, metadataFile);
+    ops.register(metadata);
 
 Review comment:
   What about using `ops.commit(null, metadata)` instead? Then `commit` could 
detect that the metadata is already written because `metadata.file()` is 
non-null and use that path instead of writing the metadata file. I think that 
would be cleaner than adding a new method to `TableOperations`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to