Skip to content

refactor: construct historical Iceberg fixtures in tests - #702

Merged
alexanderbianchi merged 1 commit into
iceberg-0.10from
codex/iceberg-time-travel-regression
Sep 9, 2026
Merged

alexanderbianchi merged 1 commit into
iceberg-0.10from
codex/iceberg-time-travel-regression

Conversation

@alexanderbianchi

@alexanderbianchi alexanderbianchi commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

Rebased directly onto iceberg-0.10 after #700, #705, #715, and #716 merged.

Strengthens the existing selected-snapshot statistics test rather than adding overlapping coverage. A test-local helper uses native Iceberg builders to add snapshot 42 while leaving the original taxi snapshot current. The completed metadata and iceberg.snapshot_id = 42 are supplied through the shared harness.

The test reports Exact(42) rows and Exact(4242) bytes, distinguishing the selected snapshot from the current snapshot's 175,000 rows and 4,480,382 bytes.

The summary totals are deliberately synthetic. The manifest still describes the original taxi data, so this fixture tests statistics planning rather than executing a 42-row scan. This limitation is documented beside its construction.

Diff against iceberg-0.10: one test file, 45 added lines, no production changes.

Validation:

  • cargo test -p datafusion-distributed-iceberg --locked --test statistics reports_statistics_for_the_selected_snapshot — passed
  • cargo fmt --all -- --check
  • git diff --check

@alexanderbianchi
alexanderbianchi force-pushed the codex/iceberg-time-travel-regression branch from 8119b08 to ec92d04 Compare September 5, 2026 20:52
@alexanderbianchi alexanderbianchi changed the title refactor: support historical Iceberg snapshot fixtures refactor: construct historical Iceberg fixtures in tests Sep 5, 2026
@alexanderbianchi
alexanderbianchi force-pushed the codex/iceberg-runtime-metadata branch from 71a906b to 3445b6a Compare September 5, 2026 21:22
@alexanderbianchi
alexanderbianchi force-pushed the codex/iceberg-time-travel-regression branch 3 times, most recently from 99c8032 to 6c531ec Compare September 6, 2026 00:18
@alexanderbianchi
alexanderbianchi force-pushed the codex/iceberg-runtime-metadata branch from 158065b to cdf47f7 Compare September 6, 2026 00:18
@alexanderbianchi
alexanderbianchi marked this pull request as ready for review September 7, 2026 14:19
alexanderbianchi added a commit that referenced this pull request Sep 9, 2026
## Less test code, stronger statistics coverage

Based directly on `iceberg-0.10` at `f9340ef`, including merged #715 and
#716. “Before” refers to that base. Only `iceberg/tests/statistics.rs`
changes, with a net reduction of 24 lines.

| Test / edge case | Before | After |
|---|---|---|
| Row count and full-scan byte size | Separate enabled/disabled test
bodies | Ordinary named tests share assertions and retain both modes |
| Full-schema column statistics | Vector length only, in another pair of
tests | Complete expected vector: populated metrics and unknown columns
|
| Reordered projection / nonconsecutive selected field IDs | Projected
vector length and row count | Exact association of metrics with
reordered columns using IDs 4, 1, and 5 |
| Null-count aggregation across files | **None** | Exact sum of 5 |
| Column-size aggregation across files | **None** | Inexact sums of 400
and 600 |
| Min/max bounds and scalar types | **None** | Int32 and Int64 bounds
checked with their precision; opposing extrema order exercises both
updating and retaining bounds |
| One file missing a column's null count | **None** | Aggregate stays
`Absent`, rather than treating missing as zero |
| Entirely missing column metrics | Only an all-empty-metrics fixture |
Unknown column alongside columns with known metrics |
| Column statistics disabled | Fixture had no metrics even when enabled
| Populated fixture must return unknown column statistics when disabled
|
| Explicit current-snapshot selection | Separate duplicate row-total
test | Fixture selects the snapshot explicitly in every matrix case |
| Missing snapshot summary totals | Present | Retained |
| Filter and projection/sort propagation | Present | Retained |
| `COUNT(*)` skips the scan | Duplicated enabled/disabled bodies and
snapshots | Both named cases retained, sharing assertions |
| Explain formatting | Two identical snapshots plus weak label checks |
One diagnostic snapshot; computed values verified by the matrix |

## Structure

- Four ordinary named Tokio tests cover full scan / reordered projection
× column statistics enabled / disabled. Two more named tests cover
`COUNT(*)` scan elimination. No `test_case` macros or dependency.
- Session setup uses the merged harness's `configure_session(...)`;
tests never access its private context.
- Native Iceberg writers create a manifest with two synthetic data-file
entries and a matching manifest list. #700's `with_file` supplies the
bytes to the harness.
- Assertions observe query-output statistics, removing the recursive
search/downcast helper and also checking projection propagation.
- `insta::allow_duplicates!` is needed only for the shared, identical
`COUNT(*)` inline snapshots.
- The fixture is planning-only: synthetic Parquet paths are not opened.
Multi-manifest merging, delete files, NDV, and verification against
actual Parquet contents are not claimed here.
- The genuinely historical-snapshot regression remains in #702; this PR
consolidates the current-snapshot-only check from #687.

## Validation

- `cargo test -p datafusion-distributed-iceberg --test statistics
--locked` — all 10 cases passed
- `cargo test -p datafusion-distributed-iceberg --locked` — 95 tests
passed, including the doctest
- `cargo test -p datafusion-distributed-iceberg --features integration
--locked` — 96 tests passed, including the doctest
- `cargo clippy -p datafusion-distributed-iceberg --all-targets --locked
-- -D warnings` — passed, also with `--all-features`
- `cargo fmt --all -- --check`
- `git diff --check`
- Mutation check: replacing computed column statistics with unknown
values fails both enabled cases; the other eight tests pass. Mutation
reverted.
- Bounds mutation check: keeping the first minimum and taking the last
maximum fails both enabled cases; the other eight tests pass. Mutation
reverted.
@alexanderbianchi
alexanderbianchi force-pushed the codex/iceberg-time-travel-regression branch from 6c531ec to 75ef728 Compare September 9, 2026 22:58
@alexanderbianchi
alexanderbianchi changed the base branch from codex/iceberg-runtime-metadata to iceberg-0.10 September 9, 2026 22:58
@alexanderbianchi
alexanderbianchi merged commit 7bb5d3e into iceberg-0.10 Sep 9, 2026
@alexanderbianchi
alexanderbianchi deleted the codex/iceberg-time-travel-regression branch September 9, 2026 23:54
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.

1 participant