RussellSpitzer commented on code in PR #10020:
URL: https://github.com/apache/iceberg/pull/10020#discussion_r1635000070
##########
api/src/main/java/org/apache/iceberg/Schema.java:
##########
@@ -507,4 +539,48 @@ public String toString() {
.map(this::identifierFieldToString)
.collect(Collectors.toList())));
}
+
+ /**
+ * Fields identified as 'Metadata Fields' will have their field ID's
reassigned.
+ *
+ * @return map of original to reassigned field ids
+ */
+ public Map<Integer, Integer> idsToReassigned() {
+ return idsToReassigned != null ? idsToReassigned : Collections.emptyMap();
+ }
+
+ /**
+ * All ids of metadata fields are reassigned.
+ *
+ * @return map of reassigned to original field ids of metadata fields
+ */
+ public Map<Integer, Integer> idsToOriginal() {
+ return idsToOriginal != null ? idsToOriginal : Maps.newHashMap();
+ }
+
+ private List<NestedField> reassignMetadataFieldIds(
+ List<NestedField> columns, Set<Integer> metadataFieldIds) {
+ Set<Integer> usedIds =
+ Sets.difference(TypeUtil.indexById(StructType.of(columns)).keySet(),
metadataFieldIds)
+ .immutableCopy();
+ AtomicInteger nextId = new AtomicInteger();
+
+ Type res =
+ TypeUtil.assignIds(
Review Comment:
I think this may have some ordering issues ... I'm not sure if this is
possible but say I see
transformId = 1000
Then after that I see
columnId = 1000
Won't I still have a problem?
--
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]