Skip to content

fix(databases): recognise a table's create commit with deltalake 1.7 (ITL-1443) - #536

Merged
eywalker merged 1 commit into
mainfrom
eywalker/itl-1443-deltalake-17-could-not-reload-after
Nov 24, 2026
Merged

eywalker merged 1 commit into
mainfrom
eywalker/itl-1443-deltalake-17-could-not-reload-after

Conversation

@eywalker

@eywalker eywalker commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes ITL-1443

deltalake 1.7 made DeltaTable.history() a lazy iterator. _created_with() indexed it outside its try, so after the commit that creates a table the reload failed with 'generator' object is not subscriptable: a Could not reload ... after committing warning, and the ids of the create were not carried forward in memory. Results and stored rows were not affected.

  • _created_with() takes the first entry of either shape (next(iter(...), None)), inside the try, because a lazy history can raise when read.
  • Tests that index or reverse history() use list(...), so they run on both versions.
  • No floor or uv.lock change is needed.

deltalake 1.7 release notes against what Orcapod uses

  • history(): the one API that broke the library.
  • MERGE conflicts: a streamed stale MERGE whose id range is, by file statistics, apart from a concurrent commit's no longer conflicts on 1.7. The non-streamed MERGE Orcapod uses already behaved so on 1.6.6. test_a_concurrent_commit_is_not_permanent merges streamed, with disjoint integer ids; it now uses the same id.
  • to_pyarrow_dataset, now refusing column-mapped tables: Orcapod creates none.
  • Unknown MERGE columns and lossy float-to-integer casts, now errors: Orcapod inserts all columns in the stored layout and checks types first.
  • to_pyarrow_table's pyarrow engine is deprecated: used in tests only.
Finding Test
history iterator fails the reload after a create, and drops its ids test_a_create_is_recognised_whatever_shape_history_has[list / iterator]
a lazy or empty history must not fail the reload test_a_create_whose_history_cannot_be_read_is_not_seeded[empty / raises when read]

MERGE conflict probe (not a test in this PR)

  • Result on 1.7.0. None of the values listed below was stored twice, but ITL-1444 found float64 and high-precision decimal ids that still are; binary ids, the only ones pipelines write, always conflict. Those ids are 1.1234567890123455 (float64) and 1.123456789012345678 (decimal(38,18)), with two writers and a non-streamed MERGE, on 1.7.0 as on 1.6.6. Compared with 1.6.6, 1.7.0 fixes only microsecond timestamps and ordinary decimals.
  • Raw Delta, non-streamed MERGE as Orcapod's, two writers, one interleaving per case: the other commit, by MERGE or by append, lands between the load and the MERGE. Tables empty and seeded; every pair of the values below, plus ten sampled batches of up to two ids per type:
    • int8, int16, int32: -5, 0, 1, 5, 100; int64: -2^62, 0, 2^53, 2^53+1, 2^62
    • float32, float64: -1.5, -0.0, 0.0, 1.5 (NaN and infinities: see below)
    • bool: both values
    • string: empty, a, b, é, U+1F600, U+FFFF; long string: 80 x, alone and followed by a, b, c or U+1F600
    • binary: empty, 00, 01, ff, 40 bytes of ff; long binary: 80 bytes of 01, then 00, 01, 02 or ff
    • date32: 1900-01-01, 1970-01-01, 2026-01-01, 2026-01-02
    • timestamp[us], with and without zone: 1900-01-01 00:00:00.000001; 2026-01-01 at 00:00:00, 00:00:00.000001 and 00:00:00.999999
    • decimal(10,2): -0.01, 0.00, 0.01, 99999999.99
    • decimal(38,18): -0.000000000000000001, 0, 12345678901234567890.123456789012345678, 12345678901234567890.123456789012345679
  • 1.6.6, the same cases: timestamps with a microsecond part and decimal(10,2) -0.01 and 0.01 were stored twice.
  • Through DeltaTableDatabase, two and three writers, one id per type: int64 5, string a, the 80-character string plus a, date32 2026-01-01, timestamp[us] 2026-01-01 00:00:00.000001 with and without zone, decimal(10,2) 0.01, float64 0.1, binary a, bool true. 1.7.0 stored each once; 1.6.6 (locked) stored the timestamps and the decimal twice.
  • The duplicates predate this PR and are not changed by it: ITL-1444.
  • Not probed: randomized concurrent processes, object stores, partitioned tables, checkpoints or compaction between the load and the commit, NaN and infinite float ids (delta-rs refuses them with its own error on both versions), null ids.

Not in this PR: a CI job on the newest deltalake. Nothing here keeps a future deltalake release under test.

Verified

  • deltalake 1.7.0, tests/test_databases and tests/test_pipeline: 9707 passed, 0 failed, no Could not reload.
  • deltalake 1.7.0 with main's delta_lake_databases.py and this branch's tests, five targeted files: 7 failed.
  • deltalake 1.6.6 (locked), targeted files: 450 passed.
  • basedpyright 0 errors; ruff, golden --check and changelog check clean.

🤖 Generated with Claude Code

…(ITL-1443)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change makes create-commit detection and test history inspection support iterator-shaped Delta history results. Tests cover create-history fallback behavior and update other history reads to materialize results before inspection.

Changes: Delta history compatibility

Layer / File(s) Summary
Create-commit recognition
src/orcapod/databases/delta_lake_databases.py, tests/test_databases/test_delta_committed_snapshot.py, changelog.d/ITL-1443.md
_created_with reads the latest history entry through an iterator. Tests cover list and iterator history, plus empty or unreadable history. The changelog records the deltalake 1.7 behavior.
History consumers and commit tests
tests/test_databases/test_append_by_name.py, tests/test_databases/test_delta_commit_failures.py, tests/test_databases/test_delta_committed_snapshot.py, tests/test_databases/test_delta_concurrent_writers.py, tests/test_pipeline/test_job_batched_commits.py, tests/test_pipeline/test_mixed_function_commits.py
Tests materialize history results before inspecting or reversing them. The concurrent-commit test uses the same ID for both competing merges.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

Merge Risk: Minimal · up to 8a470

This change restores correct table reloads after creation with deltalake 1.7 by accepting both list and iterator history. Results and stored rows were not affected. The test updates are low risk, and no merge-blocking concerns remain.

Security architecture risk: Minimal · up to 8a470

The fix lets the database recognize its own table-creation commit when history is returned as an iterator. It preserves the checks that prevent reuse of cached record IDs when the commit cannot be confirmed.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a fix in the databases module so a Delta table's create commit is recognised under deltalake 1.7 (ITL-1443). This matches the changeset, which rewrites _created_with…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: a fix in the databases module so a Delta table's create commit is recognised under deltalake 1.7 (ITL-1443). This matches the changeset, which rewrites _created_with to read history through next(iter(...), None) inside the try block, and updates tests that index or reverse history. The title is concise, specific, and follows the conventional commit style.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/orcapod/databases/delta_lake_databases.py 92.92% <100.00%> (+0.12%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eywalker
eywalker merged commit 31656eb into main Nov 24, 2026
16 checks passed
@eywalker
eywalker deleted the eywalker/itl-1443-deltalake-17-could-not-reload-after branch November 24, 2026 17:24
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