Repository navigation
Conversation
- Replace the "hash" strategy (polars hash, not portable) with "bucket", the Iceberg bucket[N] transform from cavebear. The export stores the spec in the Delta table configuration (cave.partition_spec). - Discovery gives "bucket" to integer PK and B-tree index columns, and to the view id. Other columns keep percentile_range. - A bucket count must be "auto" or a power of two in [1, 2**30]. Auto rounds up. The wizard shows the error and disables Next. - Depend on cavebear (pinned commit) and deltalake>=1.6. - deltalake 1.6 writes timestamp stats in milliseconds: update the root ID update log test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
deltalake 1.6.4 writes timestamp min/max stats truncated to milliseconds (delta-rs #4690), so a file's max can be up to 999 us before its real max. polars < 2.1 compared filters with that max and skipped files with matching rows: scan_delta returned no rows for end_time_stamp == run end (fixed in polars #30194). - Require polars>=2.1. Pin cavebear d335ccb, which does the same. - Test that a polars filter on a run end finds the run (it fails on polars 1.39.3), and explain the truncated max in the stats test. - Tell readers of the root ID update log which readers widen the max. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ubuntu-26.04 runner has the Postgres 18 client. Its pg_dump writes SET transaction_timeout, which Postgres 13 rejects, so the pg_dump transfer test restored 0 rows. The engine image also uses the Postgres 18 client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A plain write_deltalake cannot set the custom cave.partition_spec property, so cavebear.create_delta makes the table. That was done in each flush (and each view batch) after an is_deltatable check. Now the export creates every bucket lake from the first streamed batch, before any write, and each flush only appends. The create fails if a table exists, so an export never appends to a table without the spec. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Selecting flat partitioning leaves the bucket strategy set without a partition column, keeping Next enabled but causing export launch to fail with HTTP 400.
1 open issue
What changed in this PR
This PR integrates cavebear’s Iceberg bucket partitioning into Delta Lake exports, making it the default for integer ID columns and addressing #274.
Changes:
- Replaces the old hash strategy with bucket partitioning and stores its specification in Delta table metadata.
- Adds power-of-two bucket validation, automatic sizing, wizard feedback, and export tests.
- Updates Delta Lake and Polars dependencies and moves CI to PostGIS 18.
| File | Description |
|---|---|
uv.lock |
Locks cavebear and updated dependencies. |
tests/test_root_id_update_log.py |
Tests timestamp filtering with truncated statistics. |
tests/test_deltalake_export.py |
Covers bucket defaults, validation, metadata, and exports. |
templates/deltalake/step2.html |
Adds bucket selection and validation feedback. |
static/js/deltalakeStep2.js |
Validates and rounds bucket counts. |
pyproject.toml |
Adds cavebear and raises dependency minimums. |
materializationengine/workflows/root_id_update_log.py |
Documents timestamp-statistics truncation. |
materializationengine/workflows/deltalake_export.py |
Implements bucket defaults, transforms, and table creation. |
materializationengine/blueprints/deltalake/api.py |
Applies strategy-aware partition sizing. |
.github/workflows/materialization_ci.yml |
Updates the CI database to PostGIS 18. |
Review effort: Balanced
Comment on lines
+187
to
+189
| if (spec.partition_strategy !== "bucket") return null; | ||
| const n = spec.n_partitions; | ||
| if (n === null || n === undefined || n === "" || n === "auto") return null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
bucketpartition strategy for the Delta Lake export. It uses the Icebergbucket[N]transform from cavebear, and stores the spec in the table propertycave.partition_spec.id) now default tobucket. non-integer columns keeppercentile_range, and Morton keepsuniform_range(for now).hashstrategy is removed, because it was not portable or stable across polars versions.autorounds up, and the wizard shows an error for a bad count.deltalake>=1.6(needed by cavebear) andpolars>=2.1. deltalake 1.6.4 truncates timestamp stats to milliseconds, and older polars then skips files with matching rows.pg_dumpwrites a setting that Postgres 13 rejects, so thepg_dumptransfer test failed.Closes #274
Evidence
pt_root_idspec gave 8 partitions, and all sampled rows were in the right bucket.