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/07/26 22:15:10 UTC

[GitHub] [iceberg] szehon-ho commented on a diff in pull request #5327: Support force option on registerTable procedure

szehon-ho commented on code in PR #5327:
URL: https://github.com/apache/iceberg/pull/5327#discussion_r930443874


##########
api/src/main/java/org/apache/iceberg/catalog/SessionCatalog.java:
##########
@@ -147,10 +147,11 @@ public Map<String, String> properties() {
    * @param context session context
    * @param ident a table identifier
    * @param metadataFileLocation the location of a metadata file
+   * @param force default is false. If true, do register table even if table exists otherwise it will throw error.
    * @return a Table instance
    * @throws AlreadyExistsException if the table already exists in the catalog.
    */
-  Table registerTable(SessionContext context, TableIdentifier ident, String metadataFileLocation);
+  Table registerTable(SessionContext context, TableIdentifier ident, String metadataFileLocation, boolean force);

Review Comment:
   yea I was initially thinking a separate one will be more clear .



##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -215,8 +215,9 @@ protected void doRefresh() {
   @SuppressWarnings("checkstyle:CyclomaticComplexity")
   @Override
   protected void doCommit(TableMetadata base, TableMetadata metadata) {
-    String newMetadataLocation = base == null && metadata.metadataFileLocation() != null ?
-        metadata.metadataFileLocation() : writeNewMetadata(metadata, currentVersion() + 1);
+    boolean isTableForRegister = metadata.isForRegister();

Review Comment:
   Also seems like we should implement this for all the catalogs, or at least error there if this path is chosen.



##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -215,8 +215,9 @@ protected void doRefresh() {
   @SuppressWarnings("checkstyle:CyclomaticComplexity")
   @Override
   protected void doCommit(TableMetadata base, TableMetadata metadata) {
-    String newMetadataLocation = base == null && metadata.metadataFileLocation() != null ?
-        metadata.metadataFileLocation() : writeNewMetadata(metadata, currentVersion() + 1);
+    boolean isTableForRegister = metadata.isForRegister();

Review Comment:
   Should probably be called 'forReset()' or something more descriptive.  This is a bit ugly but couldn't think of a good way to avoid it.  I suppose just having a metadata with a location != null , regardless of whether base is null or not , is not enough to signal its a reset? @aokolnychyi @RussellSpitzer @rdblue for thoughts?



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