ebyhr commented on code in PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#discussion_r3223724679
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRegisterTableProcedure.java:
##########
@@ -82,4 +85,45 @@ public void testRegisterTable() throws NoSuchTableException,
ParseException {
.as("Should have the right datafile count in the procedure result")
.contains(originalFileCount, atIndex(2));
}
+
+ @TestTemplate
+ public void testRegisterTableAlreadyExistsFails() throws Exception {
+ long numRows = 1000;
Review Comment:
This variable is unused.
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRegisterTableProcedure.java:
##########
@@ -82,4 +85,45 @@ public void testRegisterTable() throws NoSuchTableException,
ParseException {
.as("Should have the right datafile count in the procedure result")
.contains(originalFileCount, atIndex(2));
}
+
+ @TestTemplate
+ public void testRegisterTableAlreadyExistsFails() throws Exception {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+
+ Table table = Spark3Util.loadIcebergTable(spark, tableName);
+ String metadataJson = TableUtil.metadataFileLocation(table);
+
+ sql("CALL %s.system.register_table('%s', '%s')", catalogName, targetName,
metadataJson);
+
+ assertThatThrownBy(
+ () ->
+ sql(
+ "CALL %s.system.register_table('%s', '%s')",
+ catalogName, targetName, metadataJson))
+ .isInstanceOf(AlreadyExistsException.class)
+ .hasMessageContaining("Table already exists");
+ }
+
+ @TestTemplate
+ public void testRegisterTableWithOverwriteNotSupported() throws Exception {
+ long numRows = 1000;
Review Comment:
This variable is unused.
--
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]