aokolnychyi commented on issue #253: Register existing tables in Iceberg 
HiveCatalog
URL: https://github.com/apache/incubator-iceberg/pull/253#issuecomment-513714263
 
 
   I think I am getting it now but there are a couple of questions I want to 
clarify before updating the PR.
   
   Of course, having a way to roll back the entire table state and minimizing 
changes to the `Catalog` API are reasonable benefits. The drawback is that we 
will have to create a separate instance of `HiveTableOperations` with its own 
HMS client pool.
   
   I am not sure we need to create a table and then replace its metadata to 
simply register a table from a metadata file. If we do so, someone might 
actually query the table before we swap the metadata location.
   
   This snippet creates a table and sets the location correctly from the 
beginning:
   
   ```
   TableOperations ops = newTableOps(identifier);
   HadoopInputFile metadataFile = 
HadoopInputFile.fromLocation(metadataFileLocation, conf);
   TableMetadata metadata = TableMetadataParser.read(ops, metadataFile);
   ops.commit(null, metadata);
   ```
   
   In theory, this can be executed directly without the catalog and will be 
sufficient to create a table form an existing metadata file. As suggested, we 
can extend `TableOperations` with `setMetadataLocation` that will be used for 
rolling back entire table state for tables already present in the catalog.

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