Gabriel39 opened a new pull request, #71365:
URL: https://github.com/apache/doris/pull/71365

   ### Background
   
   Iceberg retains historical partition specifications after partition 
evolution; each data or delete file keeps its own spec ID. Partitioned 
asynchronous materialized views map Iceberg partitions to Doris ranges and 
record source versions to decide when to refresh.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #44726 (introduced the all-spec eligibility rule)
   PR Type: Bugfix
   
   Problem Summary:
   
   Creating or refreshing a partitioned MV fails when an Iceberg table retains 
an unused unpartitioned spec or uses `identity(DATE)`, even when its live files 
have compatible date ranges. Qualify the operation's pinned snapshot using its 
default spec and live data/delete manifests, and treat DATE identity as a day 
range. Most additions are tests; adapter changes also keep qualification, 
alignment and execution on one snapshot.
   
   ### Details
   
   - **Change map:** Production +303/-49 lines; tests +628/-2; no generated, 
build or documentation changes. Tests account for most additions.
   
     | Part | Size | Purpose |
     | --- | --- | --- |
     | Shared SDK helper | +233 | Classify live data/delete specs and derive 
snapshot-bound partition summaries. |
     | Iceberg adapter | +35/-33 | Reuse existing range merging and preserve 
metadata-only ordinary pins. |
     | Refresh integration | +35/-16 | Qualify the captured snapshot and expose 
the existing pre-lock materialization hook through the common interface. |
   
   - **Frequency:** Always for the reproduced v2 history: unpartitioned → DATE 
identity → day, after rewriting all live files into day partitions while 
retaining old specs and snapshots. Live DATE identity also fails in the 
existing range builder.
   - **Root cause:** Eligibility checks every retained spec and rejects empty 
specs and identity transforms. The range builder independently lacks DATE 
identity support. Inspecting only the current spec would miss incompatible live 
files written under older specs.
   - **Why existing tests missed it:** `IcebergPartitionUtilsTest` covers time 
ranges and overlap merging without retained unsupported specs or live 
data/delete manifest classification. The existing partition-evolution SQL suite 
expects same-column day-to-year evolution through an unused empty spec to fail; 
this PR updates that assertion and adds full-row checks for rewrite, NULL and 
incremental refresh.
   - **Fix:** Keep the existing time-transform fast path. For newly compatible 
layouts, inspect live manifest entries, preserve one top-level source field ID, 
normalize DATE identity, and merge ranges. Use the pinned table snapshot as a 
conservative freshness token and distinct source names so removals and 
transitions between freshness modes force refresh. Ordinary snapshot pins 
remain metadata-only.
   - **Other paths and branches:** Both MV creation and refresh qualification 
are covered. Live unsupported data/delete layouts, changed source columns and 
non-DATE identity remain unsupported. The same rule exists in branch-4.2 and 
branch-4.1; a matching branch-4.2 backport is being prepared, while branch-4.1 
is outside this change.
   
   ### Testing
   
   - Real Iceberg metadata/manifests: four of five initial cases fail on the 
baseline and pass with the fix; the live-unpartitioned negative remains 
rejected.
   - Local selected FE UT: 336 passed across `IcebergMvPartitionEvolutionTest`, 
`IcebergMvPartitionSnapshotTest`, `IcebergPartitionUtilsTest`, 
`PluginDrivenMvccExternalTableTest`, `MTMVPartitionUtilTest` and `MTMVTaskTest`.
   - Local standard regression runner: `test_iceberg_mtmv_retained_specs` and 
`test_iceberg_mtmv_with_partition_evolution` each passed, one suite executed 
and zero skipped. Four ordered base/MV comparisons cover rewrite, append, mixed 
identity/day NULL ranges and removal followed by AUTO refresh.
   - Runtime: current FE with an attested compatible ASAN BE at 
`9fb6e4905482a6ac332819e339f70ab0e1d611ec`, using isolated Iceberg REST/MinIO 
fixtures. Native DATE/NULL Parquet read/write smoke passed. The BE was built 
from that earlier commit.
   
   ### Notes for Reviewers
   
   Newly compatible layouts may refresh every MV partition whenever the table 
snapshot changes. Existing time-transform-only tables retain their previous 
freshness path. No source metadata cleanup or source data rewrite is performed 
by the fix. The shared SDK helper is reused by the release-branch adapter.
   
   ### Release note
   
   Partitioned asynchronous materialized views support compatible Iceberg 
partition evolution with unused historical unpartitioned specs and DATE 
identity partitions, while continuing to reject unsupported live layouts.
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Ready
   
   ### AI Disclosure
   
   - Tool: Codex (GPT-6)
   - Generated: Code, tests and this description.
   - Human review: Not stated.
   - Prompts: Fix master and branch-4.2 consistently, prefer cherry-picking 
master, and resolve every local review finding before submitting the pull 
requests.
   


-- 
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]

Reply via email to