Gabriel39 commented on code in PR #67166:
URL: https://github.com/apache/doris/pull/67166#discussion_r3868228046
##########
fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergComplexTypeDiff.java:
##########
@@ -172,10 +172,11 @@ private static void applyStructChange(UpdateSchema
updateSchema, String path,
Types.NestedField oldField = oldFields.get(i);
Types.NestedField newField = newFields.get(i);
String fieldPath = path + "." + oldField.name();
- existingNames.add(oldField.name());
+ existingNames.add(oldField.name().toLowerCase(Locale.ROOT));
- // Legacy ColumnType rule: existing fields are matched by position
and may not be renamed.
- if (!oldField.name().equals(newField.name())) {
+ // A full-type MODIFY is case-insensitive and must preserve
existing Iceberg spelling; only the
+ // dedicated RENAME operation is allowed to change a field name.
+ if (!oldField.name().equalsIgnoreCase(newField.name())) {
Review Comment:
Fixed. Complex MODIFY now uses the same Locale.ROOT lowercase identity as
Iceberg and the sibling collision set. Added an InMemoryCatalog regression for
the Unicode sigma boundary and verified that a rejected positional swap leaves
both fields unchanged.
##########
fe/fe-type/src/main/java/org/apache/doris/catalog/StructField.java:
##########
@@ -51,7 +54,25 @@ public StructField(String name, Type type, String comment,
boolean containsNull)
public StructField(String name, Type type, String comment, boolean
containsNull,
boolean commentSpecified) {
+ this(name, name, type, comment, containsNull, commentSpecified);
+ }
+
+ /**
+ * Creates a field with separate names for case-insensitive runtime lookup
and external schema spelling.
+ *
+ * @param name field name normalized internally for runtime lookup
+ * @param originalName field spelling preserved for external schema
metadata
+ * @param type field type
+ * @param comment field comment
+ * @param containsNull whether the field accepts null values
+ * @param commentSpecified whether the comment was explicitly specified
+ */
+ public StructField(String name, String originalName, Type type, String
comment, boolean containsNull,
+ boolean commentSpecified) {
this.name = name.toLowerCase();
+ // Runtime struct lookup is case-insensitive, but external schemas
such as Iceberg must preserve the
+ // original spelling. Keep both so metadata writes never leak the
normalized lookup key.
+ this.originalName = originalName;
Review Comment:
Fixed. FILE TVF now preserves the raw PStructField spelling as originalName
while using the Locale.ROOT-lowercase name only for runtime lookup and
duplicate detection. Added a protobuf schema unit test and an end-to-end
Parquet FILE TVF to Iceberg CTAS regression covering direct STRUCT fields plus
STRUCT fields nested under ARRAY and MAP.
--
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]