Thanks Alex! Let us keep this thread for the vote. We can create a new discussion thread. You are also welcome to join our biweekly sync. I think those types of topics have been discussed extensively over the last few months.
Thanks, Walaa. On Tue, Nov 17, 2026 at 9:28 AM Alex Cruise <[email protected]> wrote: > +1 (non-binding), with two questions/concerns/comments and my apologies > for the last-minute engagement. I believe both concerns can be addressed by > language changes rather than anything deeper. > > 1. The summary in the first email says a consumer that finds the view > stale "must not read from the storage table" but I couldn't find that in > the PR at bf43793. > Both PoCs address this concern by comparing the refresh state's > `view-version-id` with the view's current version before applying any other > test (Spark in `isFresh`, Trino ahead of its grace period), but although > the proposed spec language mentions `view-version-id`, I couldn't find > language that requires readers to check the version before relying on the > storage table snapshot. > > More fundamentally, the proposed language doesn't say what happens to the > storage table when the query changes: > * the Trino PoC keeps the same storage table and empties it; > * the Spark PoC rejects `CREATE OR REPLACE`, with a comment that the spec > leaves this open. > > I'm not sure offhand if there's any other way to change the query in a > preexisting MV definition; perhaps some kind of ALTER? > > An engine that kept the storage table without emptying it, and used > Example 1's staleness window, would answer queries against the view from > the old query's results until the window ran out. Engines are free to use > their own freshness criteria, but maybe the proposed spec language > should require the comparison both PoCs already make. > > 2. Snapshot summaries aren't inherited, so a compaction or manifest > rewrite of a storage table leaves its current snapshot without > `refresh-state`. The spec doesn't say what a reader should conclude, and > each plausible answer has a cost: > > - *If the reader treats the view as stale*, every compaction throws > away the last refresh. The next query evaluates the view query in full > until someone refreshes, and an incremental refresh has nothing to start > from, so it becomes a full one. A storage table compacted nightly is stale > every morning. > - *If the reader looks back for the last snapshot* with > `refresh-state` (which the new "presence of a snapshot with > `refresh-state`" sentence could be read as inviting), it can serve wrong > results. That happens when anything other than a rewrite was committed in > between, such as a row-level delete for compliance, or a write from an > engine that doesn't know the table is a storage table. > - The outcome also *depends on which engine* did the maintenance. The > Trino PoC carries refresh-state forward in its own OPTIMIZE, so the same > view stays fresh after a Trino compaction and might go stale after anyone > else's--I haven't checked whether the Spark PoC follows suit. > > *Candidate normative text:* > > 1. An engine evaluating a materialized view must not use the view's > storage table in place of the view query unless the `view-version-id` of > the `refresh-state` it relies on equals the view's `current-version-id`, > regardless of the engine's freshness criteria. > > 2. The `refresh-state` an engine evaluating a materialized view relies on > is that of the current snapshot of the storage table, or else of its > nearest ancestor that has one, provided every later snapshot is a `replace` > operation. If a later snapshot has any other operation, or no such ancestor > remains, the engine must treat the storage table as never refreshed. The > sentence on using "the presence of a snapshot with refresh-state" to > distinguish a never-refreshed storage table would cite this rule. > > 3. (Optional) A writer committing a `replace` snapshot to a table it knows > to be a storage table should copy `refresh-state` from the parent snapshot, > re-reading the parent on each retry. > > Thanks, and apologies if I've misunderstood! > > -0xe1a > > > > > On Mon, Nov 16, 2026 at 12:16 PM John Zhuge via dev < > [email protected]> wrote: > >> +1 (non-binding) >> >> On Mon, Nov 16, 2026 at 10:56 AM Talat Uyarer via dev < >> [email protected]> wrote: >> >>> +1 (non-binding) >>> >>> >>> On Mon, Nov 16, 2026 at 8:33 AM Benny Chow <[email protected]> wrote: >>> >>>> +1 (non-binding) >>>> >>>> On Mon, Nov 16, 2026 at 8:20 AM Andrei Tserakhau via dev < >>>> [email protected]> wrote: >>>> >>>>> +1 (non-bingind) >>>>> >>>>> On Mon, Nov 16, 2026 at 5:02 PM Walaa Eldin Moustafa < >>>>> [email protected]> wrote: >>>>> >>>>>> +1 (non-binding) >>>>>> >>>>>> On Mon, Nov 16, 2026 at 7:49 AM Marius Grama <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> +1 n.b. >>>>>>> >>>>>>> On Mon, Nov 16, 2026 at 4:24 PM Nevin Zheng <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> +1 n.b. >>>>>>>> >>>>>>>> On Nov 16, 2026 at 7:12:11 AM, Jan Kaul via dev < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> Hi everyone, >>>>>>>>> >>>>>>>>> Following the discussion on the dev list [1 >>>>>>>>> <https://lists.apache.org/thread/zpl1pk6v7k49s30gmm3kr986bc9y7jyv>] >>>>>>>>> and the review on GitHub, I'd like to call a vote to adopt the >>>>>>>>> Materialized >>>>>>>>> View specification in PR #11041 [2 >>>>>>>>> <https://github.com/apache/iceberg/pull/11041>]. The PR adds a >>>>>>>>> "Materialized Views" section to the View spec (format/view-spec.md), >>>>>>>>> along >>>>>>>>> with the storage table metadata it relies on. >>>>>>>>> >>>>>>>>> Summary of the change: >>>>>>>>> - A materialized view is an Iceberg view whose version carries a >>>>>>>>> pointer to a storage table. The storage table is a regular Iceberg >>>>>>>>> table >>>>>>>>> that holds the precomputed results. >>>>>>>>> - Readers that do not understand materialized views ignore the >>>>>>>>> pointer and evaluate the view query directly, so existing view >>>>>>>>> consumers >>>>>>>>> keep working unchanged. >>>>>>>>> - Refresh state is recorded in the snapshot summary of the storage >>>>>>>>> table. It captures the view version that was materialized, the refresh >>>>>>>>> start timestamp, and the state of the source tables and views at >>>>>>>>> refresh >>>>>>>>> time (snapshot IDs for tables, version IDs for views). >>>>>>>>> - Consumers use the refresh state to decide whether the storage >>>>>>>>> table is fresh. When it is stale, a consumer may fail, refresh, or >>>>>>>>> fall >>>>>>>>> back to the view query, but must not read from the storage table. >>>>>>>>> >>>>>>>>> Background: >>>>>>>>> - The design follows the community's earlier decision to model a >>>>>>>>> materialized view as a separate Iceberg view and Iceberg table rather >>>>>>>>> than >>>>>>>>> a new combined catalog object [3 >>>>>>>>> <https://lists.apache.org/thread/qlvtb3wzp8yvx4jbxzpydf7rr3mvjzcq> >>>>>>>>> ]. >>>>>>>>> - Proof-of-concept implementations in Spark and Trino validate the >>>>>>>>> spec [4 <https://github.com/apache/iceberg/pull/9830>][5 >>>>>>>>> <https://github.com/trinodb/trino/pull/31027>]. Thanks to Marius >>>>>>>>> Grama and Walaa Eldin Moustafa for building them, and to everyone who >>>>>>>>> reviewed the proposal [6 >>>>>>>>> <https://github.com/apache/iceberg/issues/10043>] and the PR over >>>>>>>>> the past two years. >>>>>>>>> >>>>>>>>> Since this adds new metadata to the spec under format/, it >>>>>>>>> requires a vote. >>>>>>>>> >>>>>>>>> The vote will be open for at least 72 hours. >>>>>>>>> >>>>>>>>> [ ] +1 Adopt the Materialized View spec >>>>>>>>> [ ] +0 >>>>>>>>> [ ] -1 Do not adopt (please provide reasons) >>>>>>>>> >>>>>>>>> Here's my +1 (non-binding). >>>>>>>>> >>>>>>>>> Best, >>>>>>>>> Jan Kaul >>>>>>>>> >>>>>>>>> [1] >>>>>>>>> https://lists.apache.org/thread/zpl1pk6v7k49s30gmm3kr986bc9y7jyv >>>>>>>>> [2] https://github.com/apache/iceberg/pull/11041 >>>>>>>>> [3] >>>>>>>>> https://lists.apache.org/thread/qlvtb3wzp8yvx4jbxzpydf7rr3mvjzcq >>>>>>>>> [4] https://github.com/apache/iceberg/pull/9830 >>>>>>>>> [5] https://github.com/trinodb/trino/pull/31027 >>>>>>>>> [6] https://github.com/apache/iceberg/issues/10043 >>>>>>>>> >>>>>>>> >> >> -- >> John Zhuge >> >
