sririshindra commented on code in PR #7121:
URL: https://github.com/apache/iceberg/pull/7121#discussion_r1141193297


##########
spark/v3.3/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestMigrateTableProcedure.java:
##########
@@ -122,6 +122,38 @@ public void testMigrateWithDropBackup() throws IOException 
{
     Assert.assertFalse(spark.catalog().tableExists(tableName + "_BACKUP_"));
   }
 
+  @Test
+  public void testMigrateWithBackupSuffix() throws IOException {
+    Assume.assumeTrue(catalogName.equals("spark_catalog"));
+    String backupSuffix = "_tmp";
+    String location = temp.newFolder().toString();
+    sql(
+        "CREATE TABLE %s (id bigint NOT NULL, data string) USING parquet 
LOCATION '%s'",
+        tableName, location);
+    sql("INSERT INTO TABLE %s VALUES (1, 'a')", tableName);
+
+    Object result =
+        scalarSql(
+            "CALL %s.system.migrate(table => '%s', backup_suffix => '%s')",
+            catalogName, tableName, backupSuffix);
+
+    Assert.assertEquals("Should have added one file", 1L, result);
+
+    Table createdTable = validationCatalog.loadTable(tableIdent);
+
+    String tableLocation = createdTable.location().replace("file:", "");
+    Assert.assertEquals("Table should have original location", location, 
tableLocation);
+
+    sql("INSERT INTO TABLE %s VALUES (1, 'a')", tableName);
+
+    assertEquals(
+        "Should have expected rows",
+        ImmutableList.of(row(1L, "a"), row(1L, "a")),

Review Comment:
   Can you make this `(ImmutableList.of(row(1L, "a"), row(2L, "b")))`. 
Otherwise there is no need to do "ORDER BY id" in the next line since both ids 
are same. 



-- 
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]

Reply via email to