mxm commented on code in PR #14729:
URL: https://github.com/apache/iceberg/pull/14729#discussion_r2580472290
##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/EvolveSchemaVisitor.java:
##########
@@ -89,14 +91,23 @@ public Boolean struct(Types.StructType struct, Integer
partnerId, List<Boolean>
Types.StructType partnerStruct = findFieldType(partnerId).asStructType();
String after = null;
for (Types.NestedField targetField : struct.fields()) {
- Types.NestedField nestedField = partnerStruct.field(targetField.name());
+ Types.NestedField nestedField =
+ caseSensitive
+ ? partnerStruct.field(targetField.name())
+ : partnerStruct.caseInsensitiveField(targetField.name());
final String columnName;
if (nestedField != null) {
updateColumn(nestedField, targetField);
columnName = this.existingSchema.findColumnName(nestedField.fieldId());
} else {
addColumn(partnerId, targetField);
- columnName = this.targetSchema.findColumnName(targetField.fieldId());
+ // We need to lookup the proper parent name because the letter case
might be different on
+ // table vs target parent field (e.g. struct1.FIELD2 vs
STRUCT1.STRUCT2). This is actually a
+ // bug in SchemaUpdate#moveAfter(columnName, after) because added
fields are case-sensitive,
+ // even if case sensitivity is disabled on the API.
Review Comment:
Absolutely, if feasible in the scope of this PR. Otherwise we need to follow
up.
##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/CompareSchemasVisitor.java:
##########
@@ -88,7 +87,11 @@ public Result struct(Types.StructType struct, Integer
tableSchemaId, List<Result
}
for (Types.NestedField tableField :
tableSchemaType.asStructType().fields()) {
- if (tableField.isRequired() && struct.field(tableField.name()) == null) {
+ if (tableField.isRequired()
+ && (caseSensitive
+ ? struct.field(tableField.name())
+ : struct.caseInsensitiveField(tableField.name()))
+ == null) {
Review Comment:
Thanks, we consolidate this!
--
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]