nk1506 commented on code in PR #9852: URL: https://github.com/apache/iceberg/pull/9852#discussion_r1520875974
########## hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java: ########## @@ -181,4 +264,220 @@ default Table newHmsTable(String hmsTableOwner) { return newTable; } + + @SuppressWarnings("checkstyle:CyclomaticComplexity") + default void commitWithLocking( + Configuration conf, + BaseMetadata base, + BaseMetadata metadata, + String baseMetadataLocation, + String newMetadataLocation, + FileIO io) { + boolean newTable = base == null; + boolean hiveEngineEnabled = hiveEngineEnabled(conf, metadata); + BaseMetastoreTableOperations.CommitStatus commitStatus = + BaseMetastoreTableOperations.CommitStatus.FAILURE; + boolean updateHiveTable = false; + HiveLock lock = lockObject(metadata, conf, catalogName()); + try { + lock.lock(); + Table tbl = loadHmsTable(); + + if (tbl != null) { + String tableType = tbl.getTableType(); + if (!tableType.equalsIgnoreCase(tableType().name())) { Review Comment: @szehon-ho , If we are not adding table existense check before it will throw error as `"Table already exists: ns.view"` or `"View already exists: ns.table"` But `ViewCatalogTests` expects error message with exact content Type. Say 1. If we are creating table but with same name view already exists, it should be `"View with same name already exists:` 2. If we are creating table with same name table already exists it should be `"Table with same name already exists:` -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org