Skip to content

Delta: incremental materialization from the change data feed #2162

Closed

Description

@bplatz

Once a Delta source can be materialized (#2161), every poll would be a full read of the table. Iceberg avoids that two ways (ScanChoice in fluree-db-api/src/graph_source/r2rml.rs):

  • an added-files scan when the window is append/replace only;
  • a fallback to a full read when the window contains an overwrite or delete.

Delta offers something better than either: the change data feed. fluree-db-delta has no reader for it today.

Kernel already has the reader

delta_kernel 0.28, which fluree-db-delta/Cargo.toml already pins, ships delta_kernel::table_changes::TableChanges:

  • TableChanges::try_new(table_root, engine, start_version, end_version) plus a scan builder.
  • Rows come back with three extra columns:
    • _change_type: insert, delete, update_preimage or update_postimage;
    • _commit_version;
    • _commit_timestamp.
  • A commit's changes are read from its _change_data files if it wrote any, and otherwise derived from its add/remove actions.
  • Kernel requires delta.enableChangeDataFeed to stay on across the whole range, and the schema to be equal across it.
  • There is also a row-tracking listing mode (try_new_row_tracking_cdf_listing, with NetChanges) that needs delta.enableRowTracking instead.

Proposal

1. Reader. Add DeltaTable::changes(from_exclusive, to_inclusive) -> DeltaBatchStream over TableChanges. It yields ColumnBatches that carry the three metadata columns.

2. Window choice. Mirror ScanChoice, and log which case fired:

  • change feed, when it is enabled across (from, to];
  • else an added-files scan, when the window holds only add actions;
  • else a full read.

3. Mapping changes onto the materializer.

  • Latest-by-key mode:
    • insert and update_postimage are row images;
    • delete is a tombstone that retracts the subject;
    • update_preimage is skipped;
    • ranking is by _commit_version, ahead of any configured order_by.
  • Additive mode: a delete has no counterpart today, because additive passes never retract. Decide whether a change-feed delete retracts the row's triples, or whether additive mode keeps ignoring deletes as it does for Iceberg.

4. Per-pass bound. Cap the version range with commit-level row counts, where commitInfo.operationMetrics has them, the way Iceberg's cap_window_by_rows uses snapshot summaries. Commits are Delta's natural checkpoint.

Failure modes to handle explicitly

  • The change feed was off for part of the window: Kernel errors. Fall back to a full read, and log why.
  • The schema changed inside the window: Kernel requires equality. Split the window at the change, or fall back.
  • from has fallen out of log retention: full read. This is the Delta equivalent of FullUndeterminable.

Depends on #2161.

Activity

  1. added
    enhancement
    P2
    area:iceberg
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:icebergenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions