ulmako commented on a change in pull request #4307: URL: https://github.com/apache/iceberg/pull/4307#discussion_r831842705
########## File path: spark/v3.2/spark/src/test/java/org/apache/iceberg/spark/actions/TestRemoveOrphanFilesAction.java ########## @@ -551,6 +554,48 @@ public void testManyLeafPartitions() throws InterruptedException { Assert.assertEquals("Rows must match", records, actualRecords); } + @Test + public void testHiddenPartitionPaths() throws InterruptedException { + Schema schema = new Schema( + optional(1, "c1", Types.IntegerType.get()), + optional(2, "_c2", Types.StringType.get()), + optional(3, "c3", Types.StringType.get()) + ); + PartitionSpec spec = PartitionSpec.builderFor(schema) + .truncate("_c2", 2) + .identity("c3") + .build(); + Table table = TABLES.create(schema, spec, Maps.newHashMap(), tableLocation); + + StructType structType = new StructType() + .add("c1", DataTypes.IntegerType) + .add("_c2", DataTypes.StringType) + .add("c3", DataTypes.StringType); + List<Row> records = Lists.newArrayList( + RowFactory.create(1, "AAAAAAAAAA", "AAAA") + ); + Dataset<Row> df = spark.createDataFrame(records, structType).coalesce(1); + + df.select("c1", "_c2", "c3") + .write() + .format("iceberg") + .mode("append") + .save(tableLocation); + + df.write().mode("append").parquet(tableLocation + "/data/_c2_trunc=AA/c3=AAAA"); + df.write().mode("append").parquet(tableLocation + "/data/_c2_trunc=AA/c3=AAAA"); + + Thread.sleep(1000); + + SparkActions actions = SparkActions.get(); + + DeleteOrphanFiles.Result result = actions.deleteOrphanFiles(table) + .olderThan(System.currentTimeMillis()) + .execute(); + + Assert.assertEquals("Should delete 2 files", 2, Iterables.size(result.orphanFileLocations())); + } Review comment: I already tried to add this test, but couldn't figure out how to update the partition specs. Can you point me to an example on how to do it. -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org