RussellSpitzer commented on code in PR #4560:
URL: https://github.com/apache/iceberg/pull/4560#discussion_r853522539


##########
core/src/main/java/org/apache/iceberg/PartitionsTable.java:
##########
@@ -93,16 +93,36 @@ private static StaticDataTask.Row 
convertPartition(Partition partition) {
     return StaticDataTask.Row.of(partition.key, partition.recordCount, 
partition.fileCount, partition.specId);
   }
 
-  private static Iterable<Partition> partitions(StaticTableScan scan) {
+  private static Iterable<Partition> partitions(Table table, StaticTableScan 
scan) {
     CloseableIterable<FileScanTask> tasks = planFiles(scan);
-
-    PartitionMap partitions = new 
PartitionMap(scan.table().spec().partitionType());
+    Types.StructType partitionType = Partitioning.partitionType(table);
+    PartitionMap partitions = new PartitionMap(partitionType);
     for (FileScanTask task : tasks) {
-      partitions.get(task.file().partition()).update(task.file());
+      PartitionData original = (PartitionData) task.file().partition();
+      PartitionData normalized = normalizePartition(original, partitionType);
+      partitions.get(normalized).update(task.file());
     }
     return partitions.all();
   }
 
+  private static PartitionData normalizePartition(PartitionData partition, 
Types.StructType normalizedPartitionSchema) {
+    Map<Integer, Object> fieldIdToValues = Maps.newHashMap();

Review Comment:
   One thing we may want to consider here is caching these normalization by 
spec rather than recomputing the mapping for every partition value. Thinking 
about this code being run on millions of files



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

Reply via email to