szlta commented on a change in pull request #3411:
URL: https://github.com/apache/iceberg/pull/3411#discussion_r822676643



##########
File path: core/src/main/java/org/apache/iceberg/Partitioning.java
##########
@@ -210,7 +211,8 @@ public static StructType partitionType(Table table) {
     }
 
     Map<Integer, PartitionField> fieldMap = Maps.newHashMap();
-    List<NestedField> structFields = Lists.newArrayList();
+    Map<Integer, Type> typeMap = Maps.newHashMap();
+    Map<Integer, String> nameMap = Maps.newHashMap();

Review comment:
       @aokolnychyi  I think you're referring to what's happening in V1 tables. 
For those the spec is ever-growing in a way that no partition fields/transforms 
are removed, but rather converted to void.
   The rename logic is there: 
https://github.com/apache/iceberg/blob/master/core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Ficeberg%2FBaseUpdatePartitionSpec.java#L179
   but I think this is not used for V2 tables, as per 
https://github.com/apache/iceberg/blob/master/core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Ficeberg%2FBaseUpdatePartitionSpec.java#L261-L268
   
   Since in V2, specs don't retain old deleted partition fields this rename is 
not required for normal operations.
   
   The problem I'm describing only affects the metadata table queries, because 
for V2, due to the lack of above renames, Partitioning.partitionType() collects 
all partition fields from all previous specs too. With the lack of renames this 
can result in the same field name being present multiple times, and cause the 
PartitionsTable's (or DataFilesTable's) schema to be failed to get constructed.




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