rdblue commented on code in PR #12211:
URL: https://github.com/apache/iceberg/pull/12211#discussion_r1948233800
##########
core/src/main/java/org/apache/iceberg/schema/UnionByNameVisitor.java:
##########
@@ -157,7 +157,9 @@ private Type findFieldType(int fieldId) {
private void addColumn(int parentId, Types.NestedField field) {
String parentName = partnerSchema.findColumnName(parentId);
- api.addColumn(parentName, field.name(), field.type(), field.doc());
+ String fullName = (parentName != null ? parentName + "." : "") +
field.name();
+ api.addColumn(parentName, field.name(), field.type(), field.doc(),
field.initialDefault())
+ .updateColumnDefault(fullName, field.writeDefault());
Review Comment:
To preserve both the initial and write defaults, this creates the field with
the initial default (which sets both) and then updates the field, which sets
only the write default because the initial default cannot change once it is set.
--
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]