Skip to content

[fix](iceberg) Fix historical scans after schema evolution - #67479

Open
Gabriel39 wants to merge 1 commit into
apache:branch-4.1from
Gabriel39:fix/doris-28397-iceberg-upgrade-validation
Open

[fix](iceberg) Fix historical scans after schema evolution#67479
Gabriel39 wants to merge 1 commit into
apache:branch-4.1from
Gabriel39:fix/doris-28397-iceberg-upgrade-validation

Conversation

@Gabriel39

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: DORIS-28397

Related PR: apache/doris-shade#63

Problem Summary:

Iceberg time-travel planning can fail when a predicate references a column that was renamed or dropped after the selected snapshot. Iceberg 1.11.0 includes the upstream fix that resolves historical partition specs with the correct schema. This PR upgrades the direct and shaded Iceberg dependencies, adapts the DLF table operations constructor, and synchronizes Doris's public DeleteFileIndex fork with Iceberg 1.11.0 while retaining Java 8 source compatibility.

The shaded catalog dependency temporarily uses 3.1.3-ICEBERG-SNAPSHOT until the corresponding Doris Shade change is released.

Release note

Fix Iceberg time-travel queries after column rename or drop.

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason

    Validation performed:

    • Full FE package build with tests skipped
    • FE Checkstyle with zero violations
    • IcebergScanNodeTest: 93 tests passed, including new rename and drop cases
    • DLF Iceberg unit tests: 7 tests passed
  • Behavior changed:

    • No.
    • Yes. Historical Iceberg predicates continue to plan after later schema evolution.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

Upgrade Iceberg and its shaded catalog dependency so time-travel predicates are resolved against historical schemas. Keep the Doris DeleteFileIndex fork aligned with Iceberg 1.11.0 and add rename/drop regression coverage.\n\nIssue: DORIS-28397
@Gabriel39
Gabriel39 requested a review from yiguolei as a code owner September 3, 2026 08:07
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: four distinct issues remain on the reviewed head.

Predicate/index correctness: the regression advances the snapshot and misses the schema-only/current-snapshot failure, while the default-enabled Doris batch-mode preflight still binds the historical predicate against current-schema specs and aborts production scans.

Cache behavior and observability/performance: the public custom-planner builder cannot receive Iceberg 1.11's full historical schema map, so dropped equality-delete keys repeatedly fail cache planning, warn, and fall back to native planning.

Dependency/catalog compatibility: the currently published shaded bytecode aligns with Iceberg 1.11 and null KMS preserves DLF's supported unencrypted path, but the runtime/package dependency is still a mutable cleanup-prone snapshot rather than an immutable release. No separate ABI, KMS, concurrency, lifecycle, security, position-delete, or deletion-vector issue was substantiated. Virtual-column and Parquet/ORC decode checkpoints are not implicated by this patch.

Test coverage: the added tests exercise only native planning after a later append and do not cover the failing schema-only, Doris preflight, or custom equality-delete cache paths. Builds/tests were not run because this review runner explicitly prohibits them.

User focus: no additional focus was provided; the entire PR was reviewed. Two bounded rounds converged with every reviewer reporting no new valuable findings. Review is complete for head 1849193.

} else {
table.updateSchema().renameColumn("x", "renamed_x").commit();
}
DataFile currentDataFile = DataFiles.builder(table.spec())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Cover schema-only evolution before advancing the snapshot

Iceberg schema commits do not create a new snapshot, so immediately after this rename/drop historicalSnapshotId is still the table's current snapshot. In Iceberg 1.11, useSnapshot selects that snapshot's old schema, but SnapshotScan.specs() skips rebinding when the selected and current snapshot IDs are equal and returns specs bound to the renamed/dropped current schema. The old-name predicate then still fails in Projections. This append makes the IDs differ, so both tests avoid the unresolved case while the release note claims it is fixed. Please assert planning before this append and fix that path as well.

IcebergUtils.convertToIcebergExpr(conjunct, scan.schema());
Assert.assertNotNull(predicate);
scan = scan.filter(predicate);
Assert.assertEquals(1, materializeTasks(scan).size());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Exercise the Doris planner, not only native planFiles

This assertion calls Iceberg's TableScan.planFiles() directly, but production reaches IcebergScanNode.isBatchMode() first and batch mode defaults on. That preflight calls getMatchingManifest(..., icebergTable.specs(), scan.filter()); these specs use the current renamed/dropped schema, so the historical old-name predicate fails while Projections binds it, and the catch at isBatchMode() rethrows. Thus these tests can pass while the default production query still fails. Rebind the preflight/custom-planner specs to scan.schema() (matching Iceberg 1.11's snapshot-spec behavior) and run this regression through the Doris node.

return this;
}

Builder schemasById(Map<Integer, Schema> newSchemasById) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Expose and wire the historical-schema map

The only Doris caller of the public iterable builder is in another package, so it cannot call this new package-private setter and currently supplies only icebergTable.specs(). Iceberg 1.11 added schemasById specifically because current specs no longer contain an equality-delete field after that field is dropped; fieldLookup then returns null and forDataFile throws. Doris catches that in the manifest-cache planner and reruns native planning, so every affected scan loses the enabled cache and logs a failure. Please make this hook public, pass the frozen table's full schemas() map, and cover a dropped equality key through the cache planner.

Comment thread fe/pom.xml
</modules>
<properties>
<doris.hive.catalog.shade.version>3.1.2</doris.hive.catalog.shade.version>
<doris.hive.catalog.shade.version>3.1.3-ICEBERG-SNAPSHOT</doris.hive.catalog.shade.version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Pin an immutable shade release before merging

This changes packaged/runtime consumers to 3.1.3-ICEBERG-SNAPSHOT, and this POM configures snapshots with updatePolicy=always. The coordinate currently resolves to timestamped build 3.1.3-ICEBERG-20260903.063704-1, but a later build can silently replace it and repository cleanup can make the same Doris revision stop resolving; there is no stable 3.1.3 artifact yet, and the PR description calls this temporary. Please publish the merged Doris Shade change and pin its immutable release here before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants