github-actions[bot] commented on code in PR #65784:
URL: https://github.com/apache/doris/pull/65784#discussion_r3608461917
##########
be/src/format_v2/table_reader.cpp:
##########
@@ -488,6 +489,7 @@ Status TableReader::annotate_projected_column(const
TFileScanSlotInfo& slot_info
context->schema_column =
build_schema_column_from_external_field(*schema_field, column->type);
column->identifier = context->schema_column->identifier;
column->name_mapping = context->schema_column->name_mapping;
+ column->has_name_mapping = context->schema_column->has_name_mapping;
Review Comment:
[P1] Preserve authoritative mapping state on nested projections
This preserves `has_name_mapping` only on the projected root.
`build_schema_column_from_external_field()` does populate it recursively, but
FileScannerV2 then rebuilds complex children through
`AccessPathParser::build_nested_children()`, whose `inherit_schema_metadata()`
copies only `name_mapping`. For `s STRUCT<b INT>` where nested field `b` has an
explicit empty `names` list, both `SELECT s` and `SELECT s.b` therefore
recreate `b` with `has_name_mapping == false`; an ID-less legacy file
containing an unrelated physical `s.b` is then accepted by the current-name
fallback instead of materializing the table child as NULL/default. Please copy
the presence bit with the aliases in AccessPathParser and add whole/pruned
nested coverage (including struct descendants under array/map).
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalUtil.java:
##########
@@ -178,9 +178,11 @@ private static TField getExternalSchema(Type columnType,
Column dorisColumn,
root.setInitialDefaultValue(dorisColumn.getDefaultValue());
}
- if (nameMapping != null &&
nameMapping.containsKey(dorisColumn.getUniqueId())) {
- // for iceberg set name mapping.
- root.setNameMapping(new
ArrayList<>(nameMapping.get(dorisColumn.getUniqueId())));
+ if (nameMapping != null && !nameMapping.isEmpty()) {
Review Comment:
[P2] Keep table mapping presence when the parsed mapping is empty
`!nameMapping.isEmpty()` still conflates “no Iceberg name-mapping property”
with a present valid mapping whose JSON list is empty (`[]`).
`IcebergScanNode.extractNameMapping()` returns an empty `HashMap` in both cases
(and the bundled Iceberg 1.10.1 parser accepts an empty array), so this branch
leaves `TField.name_mapping` unset for every current field. For an ID-less
imported file, V1 and V2 then fall back to a same-current-name physical column
instead of treating the field as missing and producing its initial
default/NULL. Please preserve property presence separately from map contents
(while retaining fallback when the property is absent) and add an
absent-vs-`[]` transport/result test.
--
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]