krvikash commented on code in PR #6499:
URL: https://github.com/apache/iceberg/pull/6499#discussion_r1114945225
##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java:
##########
@@ -320,6 +326,57 @@ public void testAlreadyExistsException() {
() -> catalog.createTable(TABLE_IDENTIFIER, schema,
PartitionSpec.unpartitioned()));
}
+ @Test
+ public void testCreateTableCommitThrowsUnknownException()
+ throws TException, InterruptedException {
+ String namespace = DB_NAME;
+ String tableName = getRandomName();
+ TableIdentifier tableIdentifier = TableIdentifier.of(namespace, tableName);
+
+ HiveTableOperations hiveTableOperations =
+ (HiveTableOperations) catalog.newTableOps(tableIdentifier);
+
+ String tableLocation = catalog.defaultWarehouseLocation(tableIdentifier);
+ TableMetadata metadataV1 = createTableMetadata(tableLocation);
+
+ HiveTableOperations spyOps = spy(hiveTableOperations);
+ failCommitAndThrowException(spyOps);
+
+ Assertions.assertThatThrownBy(() -> spyOps.commit(null, metadataV1))
+ .isInstanceOf(RuntimeException.class)
+ .hasMessageContaining("Datacenter on fire");
+
+ Assert.assertEquals(
+ "One metadata files should exist",
+ 1,
+ metadataFileCount(tableLocation + "/writeMetaDataLoc"));
Review Comment:
Also, note that `TableMetadata#metadataFileLocation` will not be set with
the new metadata file location until the table is created. In this PR case, the
table will not be created as it fails during `commit`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]