aokolnychyi commented on code in PR #15268:
URL: https://github.com/apache/iceberg/pull/15268#discussion_r2785370210
##########
api/src/main/java/org/apache/iceberg/Schema.java:
##########
@@ -629,4 +631,30 @@ public static void checkCompatibility(Schema schema, int
formatVersion) {
formatVersion, Joiner.on("\n- ").join(problems.values())));
}
}
+
+ // indexes all fields from schemas, preferring field definitions from higher
schema IDs
+ public static Map<Integer, NestedField> indexFields(Collection<Schema>
schemas) {
+ if (schemas.size() == 1) {
+ Schema schema = Iterables.getOnlyElement(schemas);
+ return schema.lazyIdToField();
+ }
+
+ Map<Integer, NestedField> fields = Maps.newHashMap();
+ Set<Integer> seenSchemaIds = Sets.newHashSet();
+
+ for (Schema schema : sortByIdAsc(schemas)) {
+ if (!seenSchemaIds.contains(schema.schemaId())) {
Review Comment:
That's a good idea.
--
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]