github-actions[bot] commented on code in PR #66007:
URL: https://github.com/apache/doris/pull/66007#discussion_r3652789486
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergUtils.java:
##########
@@ -1467,7 +1464,9 @@ public static IcebergTableQueryInfo getQuerySpecSnapshot(
return new IcebergTableQueryInfo(
snapshotRef.snapshotId(),
refName,
- SnapshotUtil.schemaFor(table, refName).schemaId());
+ // Iceberg maps a branch name to the table's latest schema, so
resolve the branch
+ // head snapshot directly to keep historical branch columns
isolated.
+ SnapshotUtil.schemaFor(table,
snapshotRef.snapshotId()).schemaId());
Review Comment:
[P1] Preserve Iceberg's current schema for branch reads
This is a separate contract issue from the downstream filter/schema mismatch
already discussed at this line. The new code maps every named ref through the
numeric snapshot overload, but the pinned Iceberg 1.10.1 API distinguishes
branches from tags: `SnapshotUtil.schemaFor(Table, String)` returns
`table.schema()` for a branch and the referenced snapshot schema only for a
tag, and `SnapshotScan.useRef` follows that helper. Consequently, a branch
created before `DROP col; ADD new_col` must expose `new_col` under the table's
current schema (NULL for its old files), not resurrect `col`. The same bug
exists in the `VERSION AS OF '<ref>'` arm below. This also makes Doris build
tuple/default/position metadata from the old schema while `IcebergScanNode`
still calls `scan.useRef(ref)` and plans the branch with the current schema.
Please preserve ref-aware branch-versus-tag schema selection while using the
resolved snapshot ID only as the data fence; a downstream pinning fix must not
conver
t branches to historical-schema reads. See the [Iceberg 1.10.1
implementation](https://github.com/apache/iceberg/blob/apache-iceberg-1.10.1/core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java#L410-L429)
and the [branch/tag schema-selection
contract](https://iceberg.apache.org/docs/latest/branching/#schema-selection-with-branches-and-tags).
--
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]