RussellSpitzer commented on a change in pull request #2210:
URL: https://github.com/apache/iceberg/pull/2210#discussion_r591644516
##########
File path: spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java
##########
@@ -621,6 +640,32 @@ public static void importSparkPartitions(
}
}
+ public static List<SparkPartition> filterPartitions(List<SparkPartition>
partitions,
+ Map<String, String>
partitionFilter) {
+ if (partitionFilter.isEmpty()) {
+ // No partition filter arg
+
+ if (partitions.isEmpty()) {
+ throw new IllegalArgumentException("Cannot add files, no files found
in the table.");
+ }
+ return partitions;
+ } else {
+ // Partition filter arg passed
+
+ List<SparkTableUtil.SparkPartition> filteredPartitions = partitions
+ .stream().filter(p ->
p.getValues().entrySet().containsAll(partitionFilter.entrySet()))
Review comment:
I'm not sure, but if we don't match here we don't match against the
iceberg column names which means we'll have some issues later. I'll add a test
to check
----------------------------------------------------------------
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]