kbendick commented on a change in pull request #4307:
URL: https://github.com/apache/iceberg/pull/4307#discussion_r828185482



##########
File path: 
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/actions/BaseDeleteOrphanFilesSparkAction.java
##########
@@ -205,15 +211,27 @@ private String jobDesc() {
     JavaRDD<String> subDirRDD = sparkContext().parallelize(subDirs, 
parallelism);
 
     Broadcast<SerializableConfiguration> conf = 
sparkContext().broadcast(hadoopConf);
-    JavaRDD<String> matchingLeafFileRDD = 
subDirRDD.mapPartitions(listDirsRecursively(conf, olderThanTimestamp));
+    JavaRDD<String> matchingLeafFileRDD =
+        subDirRDD.mapPartitions(listDirsRecursively(conf, olderThanTimestamp, 
filter));
 
     JavaRDD<String> completeMatchingFileRDD = 
matchingFileRDD.union(matchingLeafFileRDD);
     return spark().createDataset(completeMatchingFileRDD.rdd(), 
Encoders.STRING()).toDF("file_path");
   }
 
+  private PathFilter pathFilter(PartitionSpec spec) {
+    List<String> partitionNames = Lists.newArrayList();
+    for (PartitionField field : spec.fields()) {
+      if (field.name().startsWith("_") || field.name().startsWith(".")) {
+        partitionNames.add(field.name());
+      }
+    }

Review comment:
       This function looks correct for a given partition spec, but for tables 
that have evolved their partitioning over time, we'd need to consider past 
partition predicates.
   
   Tables now track all of their past partition specs using the `specs` field 
from the table. See 
https://github.com/apache/iceberg/blob/c1adf2034280884d05afad4e67f09f2872c47d78/api/src/main/java/org/apache/iceberg/Table.java#L77-L82




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