You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "dbjnbnrj (via GitHub)" <gi...@apache.org> on 2026/04/15 22:30:04 UTC
[PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
dbjnbnrj opened a new pull request, #15993:
URL: https://github.com/apache/iceberg/pull/15993
Add an optional `overwrite` boolean parameter to the `register_table` Spark procedure in Spark 4.1. This allows users to overwrite existing table registrations when calling the procedure, aligning with the Iceberg Spec (https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml#L3779-L3782)
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#issuecomment-4964178696
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "dbjnbnrj (via GitHub)" <gi...@apache.org>.
dbjnbnrj commented on code in PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#discussion_r3096406248
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRegisterTableProcedure.java:
##########
@@ -82,4 +83,59 @@ 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 NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
Review Comment:
Thanks for the suggestion! Done.
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#issuecomment-5028805685
This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "huaxingao (via GitHub)" <gi...@apache.org>.
huaxingao commented on code in PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#discussion_r3089930870
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRegisterTableProcedure.java:
##########
@@ -82,4 +83,59 @@ 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 NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
+
+ 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(Exception.class)
+ .hasMessageContaining("Table already exists");
+ }
+
+ @TestTemplate
+ public void testRegisterTableWithOverwriteNotSupported()
+ throws NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
+
+ Table table = Spark3Util.loadIcebergTable(spark, tableName);
+ String metadataJson = TableUtil.metadataFileLocation(table);
+
+ sql("CALL %s.system.register_table('%s', '%s')", catalogName, targetName, metadataJson);
+
+ // The test setup uses HiveCatalog which doesn't support overwrite, so it falls back to the
+ // default implementation in Catalog interface which throws UnsupportedOperationException.
+ // This verifies that the 'overwrite' parameter is correctly passed to the catalog.
+ // The third argument in register_table procedure is overwrite = true.
+ assertThatThrownBy(
+ () ->
+ sql(
+ "CALL %s.system.register_table('%s', '%s', true)",
+ catalogName, targetName, metadataJson))
+ .isInstanceOf(Exception.class)
+ .hasMessageContaining("Registering tables with overwrite is not supported");
+ }
Review Comment:
The tests only cover failure cases (table already exists, overwrite not supported). Can we have a a positive test to show overwrite actually replacing a registration?
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "huaxingao (via GitHub)" <gi...@apache.org>.
huaxingao commented on code in PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#discussion_r3089921695
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRegisterTableProcedure.java:
##########
@@ -82,4 +83,59 @@ 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 NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
+
+ 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(Exception.class)
Review Comment:
Can we make the exception type assertions more specific?
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#issuecomment-4686365966
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "dbjnbnrj (via GitHub)" <gi...@apache.org>.
dbjnbnrj commented on code in PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#discussion_r3096502714
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRegisterTableProcedure.java:
##########
@@ -82,4 +83,59 @@ 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 NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
+
+ 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(Exception.class)
Review Comment:
Thanks for the suggestion! Done.
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "huaxingao (via GitHub)" <gi...@apache.org>.
huaxingao commented on code in PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#discussion_r3089923973
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRegisterTableProcedure.java:
##########
@@ -82,4 +83,59 @@ 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 NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
+
+ 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(Exception.class)
+ .hasMessageContaining("Table already exists");
+ }
+
+ @TestTemplate
+ public void testRegisterTableWithOverwriteNotSupported()
+ throws NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
+
+ Table table = Spark3Util.loadIcebergTable(spark, tableName);
+ String metadataJson = TableUtil.metadataFileLocation(table);
+
+ sql("CALL %s.system.register_table('%s', '%s')", catalogName, targetName, metadataJson);
+
+ // The test setup uses HiveCatalog which doesn't support overwrite, so it falls back to the
+ // default implementation in Catalog interface which throws UnsupportedOperationException.
+ // This verifies that the 'overwrite' parameter is correctly passed to the catalog.
+ // The third argument in register_table procedure is overwrite = true.
+ assertThatThrownBy(
+ () ->
+ sql(
+ "CALL %s.system.register_table('%s', '%s', true)",
+ catalogName, targetName, metadataJson))
+ .isInstanceOf(Exception.class)
Review Comment:
ditto
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
ebyhr commented on code in PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#discussion_r3090009591
##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/procedures/RegisterTableProcedure.java:
##########
@@ -46,9 +46,11 @@ class RegisterTableProcedure extends BaseProcedure {
requiredInParameter("table", DataTypes.StringType);
private static final ProcedureParameter METADATA_FILE_PARAM =
requiredInParameter("metadata_file", DataTypes.StringType);
+ private static final ProcedureParameter OVERWRITE_PARAM =
+ optionalInParameter("overwrite", DataTypes.BooleanType, "false");
Review Comment:
Could you update `docs/docs/spark-procedures.md`?
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRegisterTableProcedure.java:
##########
@@ -82,4 +83,59 @@ 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 NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
Review Comment:
We could remove this append. An empty table is sufficient to verify "Table already exists" failure.
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRegisterTableProcedure.java:
##########
@@ -82,4 +83,59 @@ 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 NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
+
+ 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(Exception.class)
+ .hasMessageContaining("Table already exists");
+ }
+
+ @TestTemplate
+ public void testRegisterTableWithOverwriteNotSupported()
+ throws NoSuchTableException, ParseException {
Review Comment:
nit: We could change to `throws Exception`. It's just a test method, so listing all exceptions isn't necessary.
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "dbjnbnrj (via GitHub)" <gi...@apache.org>.
dbjnbnrj commented on code in PR #15993:
URL: https://github.com/apache/iceberg/pull/15993#discussion_r3096403653
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRegisterTableProcedure.java:
##########
@@ -82,4 +83,59 @@ 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 NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
+
+ 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(Exception.class)
+ .hasMessageContaining("Table already exists");
+ }
+
+ @TestTemplate
+ public void testRegisterTableWithOverwriteNotSupported()
+ throws NoSuchTableException, ParseException {
+ long numRows = 1000;
+
+ sql("CREATE TABLE %s (id int, data string) using ICEBERG", tableName);
+ spark
+ .range(0, numRows)
+ .withColumn("data", functions.col("id").cast(DataTypes.StringType))
+ .writeTo(tableName)
+ .append();
+
+ Table table = Spark3Util.loadIcebergTable(spark, tableName);
+ String metadataJson = TableUtil.metadataFileLocation(table);
+
+ sql("CALL %s.system.register_table('%s', '%s')", catalogName, targetName, metadataJson);
+
+ // The test setup uses HiveCatalog which doesn't support overwrite, so it falls back to the
+ // default implementation in Catalog interface which throws UnsupportedOperationException.
+ // This verifies that the 'overwrite' parameter is correctly passed to the catalog.
+ // The third argument in register_table procedure is overwrite = true.
+ assertThatThrownBy(
+ () ->
+ sql(
+ "CALL %s.system.register_table('%s', '%s', true)",
+ catalogName, targetName, metadataJson))
+ .isInstanceOf(Exception.class)
+ .hasMessageContaining("Registering tables with overwrite is not supported");
+ }
Review Comment:
Thanks - I moved the positive test case to a separate test class (TestRegisterTableProcedureWithOverwriteSupport) as the standard catalogs used in `CatalogTestBase` (like `HiveCatalog` and `HadoopCatalog`) do not currently override the registerTable(..., overwrite) method. I tried to use the logic from /usr/local/google/home/bdebjani/iceberg/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java testRegisterTableOverwriteTrueSupported to test with overwrite=true.
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #15993: Spark: Add overwrite parameter to register_table procedure
URL: https://github.com/apache/iceberg/pull/15993
--
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
Re: [PR] Spark: Add overwrite parameter to register_table procedure [iceberg]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
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: 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