karuppayya commented on a change in pull request #2087:
URL: https://github.com/apache/iceberg/pull/2087#discussion_r557483889
##########
File path:
spark3/src/test/java/org/apache/iceberg/actions/TestCreateActions.java
##########
@@ -157,6 +168,105 @@ public void testMigratePartitioned() throws Exception {
assertMigratedFileCount(Actions.migrate(source), source, dest);
}
+ @Test
+ public void testPartitionedTableWithUnRecoveredPartitions() throws Exception
{
+ Assume.assumeTrue("Cannot migrate to a hadoop based catalog",
!type.equals("hadoop"));
+ Assume.assumeTrue("Can only migrate from Spark Session Catalog",
catalog.name().equals("spark_catalog"));
+ String source = sourceName("test_unrecovered_partitions");
+ String dest = source;
+ File location = temp.newFolder();
+ spark.sql(String.format(CREATE_PARTITIONED_PARQUET, source, location));
+ spark.range(5)
+ .selectExpr("id", "cast(id as STRING) as data")
+ .write()
+ .partitionBy("id").mode("overwrite")
+ .parquet(location.toURI().toString());
+ spark.sql(String.format("alter table %s add partition(id=0)", source));
+ assertMigratedFileCount(Actions.migrate(source), source, dest);
+ }
+
+ @Test
+ public void testPartitionedTableWithCustomPartitions() throws Exception {
+ Assume.assumeTrue("Cannot migrate to a hadoop based catalog",
!type.equals("hadoop"));
+ Assume.assumeTrue("Can only migrate from Spark Session Catalog",
catalog.name().equals("spark_catalog"));
+ String source = sourceName("test_custom_parts");
+ String dest = source;
+ File tblLocation = temp.newFolder();
+ File partitionDataLoc = temp.newFolder();
+ spark.sql(String.format(CREATE_PARTITIONED_PARQUET, source, tblLocation));
+ spark.range(10)
+ .selectExpr("cast(id as STRING) as data")
+ .write()
+ .mode("overwrite").parquet(partitionDataLoc.toURI().toString());
+ spark.sql(String.format("alter table %s add partition(id=0) LOCATION
'%s'", source,
Review comment:
Partly yes. The change was also required for the another test case
regarding unrecovered partitions.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]