github-actions[bot] commented on code in PR #67166:
URL: https://github.com/apache/doris/pull/67166#discussion_r3868407634
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/types/StructField.java:
##########
@@ -49,7 +50,23 @@ public StructField(String name, DataType dataType, boolean
nullable, String comm
public StructField(String name, DataType dataType, boolean nullable,
String comment,
boolean commentSpecified) {
+ this(name, name, dataType, nullable, comment, 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 dataType field data type
+ * @param nullable whether the field accepts null values
+ * @param comment field comment
+ * @param commentSpecified whether the comment was explicitly specified
+ */
+ public StructField(String name, String originalName, DataType dataType,
boolean nullable, String comment,
+ boolean commentSpecified) {
this.name = Objects.requireNonNull(name, "name should not be
null").toLowerCase();
Review Comment:
[P1] Normalize the runtime key with Locale.ROOT
The new split-name contract is still locale-dependent on its runtime half:
both changed `StructField` constructors call the no-argument `toLowerCase()`,
and both `StructType` maps/lookups do the same. On an FE started with `tr-TR`,
`STRUCT<I:INT>` stores the runtime key as dotless `ı`, while this PR exports
the preserved `I` to Iceberg and its new identity checks normalize that
spelling to ROOT `i`; `element_at(payload, 'i')` therefore cannot find the
field, and ROOT-distinct `I`/`ı` fields collapse internally. This is upstream
of, and distinct from, the fixed `equalsIgnoreCase` MODIFY thread. Please use
one `Locale.ROOT` key consistently across both `StructField`/`StructType` pairs
and the same normalization in `CreateNamedStruct`,
`AccessPathExpressionCollector`, and `NestedColumnPruning`; otherwise scan
pruning can still select a locale-dependent sibling after analysis succeeds.
Cover uppercase `I` plus dotless `ı` under a Turkish default locale.
##########
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(lowercaseName(oldField.name()));
- // Legacy ColumnType rule: existing fields are matched by position
and may not be renamed.
- if (!oldField.name().equals(newField.name())) {
+ // Iceberg defines case-insensitive identity with ROOT-lowercase
keys. Java equalsIgnoreCase is
+ // broader for some Unicode characters and could otherwise route
an update to the wrong field.
+ if
(!lowercaseName(oldField.name()).equals(lowercaseName(newField.name()))) {
Review Comment:
[P1] Canonicalize the top-level MODIFY path too
This ROOT-based child match is still unreachable when the existing complex
column itself has mixed-case spelling. For an Iceberg field `Payload
STRUCT<CaseSensitive:INT>`, `MODIFY COLUMN payload
STRUCT<casesensitive:BIGINT>` reaches `IcebergCatalogOps.modifyColumn` with
`payload`; that method calls the case-sensitive
`schema.findField(column.getName())` and throws before this diff runs. It also
reuses the requested spelling for the diff, doc, nullability, and position
paths. The nested MODIFY and flat rename paths already resolve
case-insensitively and retain the canonical stored path. Please do the same for
flat MODIFY, use `current.name()` for every staged update, resolve any `AFTER
<sibling>` reference to its stored spelling too, and add a catalog-backed test
with a case-mismatched mixed-case root.
--
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]