github-actions[bot] commented on code in PR #65329:
URL: https://github.com/apache/doris/pull/65329#discussion_r3536107441
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java:
##########
@@ -927,13 +1046,60 @@ private void validateForModifyComplexColumn(Column
column, NestedField currentCo
throw new UserException(e.getMessage(), e);
}
if (currentCol.isOptional() && !column.isAllowNull()) {
- throw new UserException("Cannot change nullable column " +
column.getName() + " to not null");
+ throw new UserException("Cannot change nullable column " +
columnPath + " to not null");
}
if (column.getDefaultValue() != null ||
column.getDefaultValueExprDef() != null) {
throw new UserException("Complex type default value only supports
NULL");
}
}
+ @VisibleForTesting
+ org.apache.iceberg.types.Type resolveNestedColumnPath(Schema schema,
ColumnPath columnPath, String operation)
+ throws UserException {
+ org.apache.iceberg.types.Type currentType = schema.asStruct();
+ String currentPath = "";
+ for (String part : columnPath.getParts()) {
+ if (!currentPath.isEmpty()) {
+ currentPath += ".";
Review Comment:
Please make nested path resolution case-insensitive and return the canonical
Iceberg path before calling `UpdateSchema`. Doris lower-cases Iceberg metadata
when it builds `Column`/`StructField`, so a Spark-created schema such as `Info
STRUCT<Metric: INT>` is exposed to users as `info.metric`. This resolver uses
`StructType.field(part)`, which is exact-name lookup, and `modifyColumn` also
calls exact `schema.findField(columnPath.getFullPath())`; as a result `ALTER
TABLE ... MODIFY COLUMN info.metric ...` and adding a child under `info` reject
the existing field even though that is the only Doris-visible spelling. Please
resolve with Iceberg case-insensitive APIs, then pass the canonical path names
to validation and `updateSchema.*`.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java:
##########
@@ -927,13 +1046,60 @@ private void validateForModifyComplexColumn(Column
column, NestedField currentCo
throw new UserException(e.getMessage(), e);
}
if (currentCol.isOptional() && !column.isAllowNull()) {
- throw new UserException("Cannot change nullable column " +
column.getName() + " to not null");
+ throw new UserException("Cannot change nullable column " +
columnPath + " to not null");
}
if (column.getDefaultValue() != null ||
column.getDefaultValueExprDef() != null) {
throw new UserException("Complex type default value only supports
NULL");
}
}
+ @VisibleForTesting
+ org.apache.iceberg.types.Type resolveNestedColumnPath(Schema schema,
ColumnPath columnPath, String operation)
+ throws UserException {
+ org.apache.iceberg.types.Type currentType = schema.asStruct();
+ String currentPath = "";
+ for (String part : columnPath.getParts()) {
+ if (!currentPath.isEmpty()) {
+ currentPath += ".";
+ }
+ currentPath += part;
+
+ if (currentType.isStructType()) {
+ NestedField field = currentType.asStructType().field(part);
Review Comment:
Please make nested path resolution case-insensitive and return the canonical
Iceberg path before calling `UpdateSchema`. Doris lower-cases Iceberg metadata
when it builds `Column`/`StructField`, so a Spark-created schema such as `Info
STRUCT<Metric: INT>` is exposed to users as `info.metric`. This resolver uses
`StructType.field(part)`, which is exact-name lookup, and `modifyColumn` also
calls exact `schema.findField(columnPath.getFullPath())`; as a result `ALTER
TABLE ... MODIFY COLUMN info.metric ...` and adding a child under `info` reject
the existing field even though that is the only Doris-visible spelling. Please
resolve with Iceberg case-insensitive APIs, then pass the canonical path names
to validation and `updateSchema.*`.
--
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]