szehon-ho commented on code in PR #5409:
URL: https://github.com/apache/iceberg/pull/5409#discussion_r934760582
##########
api/src/main/java/org/apache/iceberg/UpdateSchema.java:
##########
@@ -389,6 +389,31 @@ default UpdateSchema updateColumn(String name,
Type.PrimitiveType newType, Strin
*/
UpdateSchema unionByNameWith(Schema newSchema);
+ /**
+ * Applies all field additions and updates from the provided new schema to
the existing schema so
+ * to create a union schema.
+ *
+ * <p>For fields with same canonical names in both schemas it is required
that the widen types is
+ * supported using {@link UpdateSchema#updateColumn(String,
Type.PrimitiveType)}
+ *
+ * <p>Only supports turning a previously required field into an optional one
if it is marked
+ * optional in the provided new schema using {@link
UpdateSchema#makeColumnOptional(String)}
+ *
+ * <p>Only supports updating existing field docs with fields docs from the
provided new schema
+ * using {@link UpdateSchema#updateColumnDoc(String, String)}
+ *
+ * @param newSchema a schema used in conjunction with the existing schema to
create a union schema
+ * @param caseSensitive when false, the case of field in schema is ignored
+ * @return this for method chaining
+ * @throws IllegalStateException If it encounters errors during provided
schema traversal
+ * @throws IllegalArgumentException If name doesn't identify a column in the
schema or if this
+ * change introduces a type incompatibility or if it conflicts with
other additions, renames,
+ * or updates.
+ */
+ default UpdateSchema unionByNameWith(Schema newSchema, boolean
caseSensitive) {
Review Comment:
Looks like the general pattern for caseSensitivity in these API's class is
to add a new method 'UpdateSchema caseSensitive(boolean caseSensitive)', to
avoid the matrix of new methods need to be added for each flag. See RowDelta,
OverwriteFiles, DeleteFiles for example
--
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]