kbendick commented on code in PR #5409:
URL: https://github.com/apache/iceberg/pull/5409#discussion_r937025391
##########
api/src/main/java/org/apache/iceberg/types/TypeUtil.java:
##########
@@ -288,13 +288,41 @@ public static Schema reassignIds(Schema schema, Schema
idSourceSchema) {
return new Schema(struct.fields(), refreshIdentifierFields(struct,
schema));
}
+ /**
+ * Reassigns ids in a schema from another schema.
+ *
+ * <p>Ids are determined by field names. If a field in the schema cannot be
found in the source
+ * schema, this will throw IllegalArgumentException.
+ *
+ * <p>This will not alter a schema's structure, nullability, or types.
+ *
+ * @param schema the schema to have ids reassigned
+ * @param idSourceSchema the schema from which field ids will be used
+ * @return an structurally identical schema with field ids matching the
source schema
+ * @throws IllegalArgumentException if a field cannot be found (by name) in
the source schema
+ */
+ public static Schema reassignIds(Schema schema, Schema idSourceSchema,
boolean caseSensitive) {
Review Comment:
+1 this avoids mistakes with changing logic later
--
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]