Skip to content

Commit

Permalink
Addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nk1506 committed Mar 28, 2024
1 parent 93731df commit 57eff75
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void doCommit(ViewMetadata base, ViewMetadata metadata) {
boolean hiveEngineEnabled = false;

CommitStatus commitStatus = CommitStatus.FAILURE;
boolean updateHiveTable = false;
boolean updateHiveView = false;

HiveLock lock = lockObject();
try {
Expand All @@ -134,10 +134,16 @@ public void doCommit(ViewMetadata base, ViewMetadata metadata) {
if (newView
&& tbl.getParameters().get(BaseMetastoreTableOperations.METADATA_LOCATION_PROP)
!= null) {
throw new AlreadyExistsException("View already exists: %s.%s", database, viewName);
throw new AlreadyExistsException(
"%s already exists: %s.%s",
tbl.getTableType().equalsIgnoreCase(TableType.VIRTUAL_VIEW.name())
? ContentType.VIEW.value()
: ContentType.TABLE.value(),
database,
viewName);
}

updateHiveTable = true;
updateHiveView = true;
LOG.debug("Committing existing view: {}", fullName);
} else {
tbl =
Expand Down Expand Up @@ -178,7 +184,7 @@ public void doCommit(ViewMetadata base, ViewMetadata metadata) {
lock.ensureActive();

try {
persistTable(tbl, updateHiveTable, hiveLockEnabled(conf) ? null : baseMetadataLocation);
persistTable(tbl, updateHiveView, hiveLockEnabled(conf) ? null : baseMetadataLocation);
lock.ensureActive();

commitStatus = CommitStatus.SUCCESS;
Expand All @@ -190,7 +196,7 @@ public void doCommit(ViewMetadata base, ViewMetadata metadata) {
+ "Please check the commit history. If you are running into this issue, try reducing "
+ "iceberg.hive.lock-heartbeat-interval-ms.",
le);
} catch (AlreadyExistsException e) {
} catch (org.apache.hadoop.hive.metastore.api.AlreadyExistsException e) {
throw new AlreadyExistsException(e, "View already exists: %s.%s", database, viewName);

} catch (InvalidObjectException e) {
Expand Down

0 comments on commit 57eff75

Please sign in to comment.