Repository navigation
fix(index): write zone map seeds when a seeded column gets a new data file - #9868
Conversation
04558d7 to
5c433a7
Compare
|
Added two tests in c52ac6a for partial updates of a fragment that already has deleted rows: a merge_insert column rewrite that matches only some rows, and a |
|
d6aff73 addresses the review's items 2 and 4. Item 4: Item 2: two tests cover the writes that the mode gate ( Item 3 was already covered by c52ac6a. Items 1 and 5 are out of this PR's scope by design: the PR only guarantees that new data files for a seeded column carry correct seeds; it does not change how the index merge consumes them. |
|
9e2b392: the batched |
|
6055aef fixes the view-input regression. Cause. merge_insert's column rewrite and the fragment Fix. Both consumers now receive the batch normalized once through Audit of the other path. Tests. Two merge_insert full-fragment rewrites, Utf8View → Utf8 and BinaryView → Binary (the latter fed in three-row source batches that cross the four-row zone edges), both with nulls. Each verifies the written values, reads the replacement file's physical column and compares its recomputed seed byte for byte with the stored seed. On the previous head the Utf8View test failed with the type mismatch above; the BinaryView case was first written against |
… file When a column has a ZoneMap index with write seeds enabled, every writer that produces a new data file for that column must embed a seed built from the values it wrote. Only the fragment append path did so; column rewrites (merge_insert in column-rewrite mode, the fragment Updater used by add_columns, merge and alter_columns, and FileFragment::write_columns used by computed and function column refreshes) wrote replacement column files without seeds. One SeedCollector now resolves the seed writers for the columns of the file being written and is used by all of those writers, so the data file that serves a seeded column always carries a seed of its current values. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The expected seed is built from the physical column read back from the replacement file, deleted rows included, rather than from a scan that filters them out; write_columns is also driven with several batches. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…file A failure to load the indices no longer leaves an empty staged file behind in write_columns, and merge_insert's column rewrite follows the same order. Tests cover the two writes the mode gate newly seeds: the fragments rewritten by Dataset::update and the fragments merge_insert inserts for unmatched rows. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…daries Ten rows in three batches put the batch edges exactly on the four-row zone edges; four batches make every zone but the last span two batches. Co-Authored-By: Claude Fable 5.1 <[email protected]>
merge_insert's column rewrite and the fragment Updater handed the seed collector the caller's batch while the data file writer converted it on its own, so a Utf8View or BinaryView input for a seeded Utf8 or Binary column failed with a type mismatch in the seed writer. Both consumers now receive the batch normalized once through SchemaAdapter, as the fragment write path already did. write_columns rejects view input before writing and is unchanged. Co-Authored-By: Claude Fable 5.1 <[email protected]>
6055aef to
b7e0736
Compare
|
Rebased onto main at |
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The rebase preserves the reviewed seed-writing behavior and the view-input fix. For seed-enabled ZoneMap columns, replacement files still carry seeds matching their physical values, including nulls and deleted-row positions. No blocking items remain.
westonpace
left a comment
There was a problem hiding this comment.
Thanks for both the enhanced test coverage and the fix
What this PR does
If a column has a ZoneMap index with write seeds enabled, writing a new data file for that column should also write new seeds into that file.
Write seeds are small statistics collected while writing column values. They describe the values stored in that particular data file.
This PR makes column-update and refresh writers collect seeds, just as the append writer already does.
Example
Refreshing a column writes a replacement column file; it does not change the old file in place:
Before this PR, the replacement file was written without seeds. After this PR, an eligible column's new file contains both its data and the seeds collected from that data.
Writing paths covered
FileFragment::write_columns: collects seeds when staging replacement column files, including the path used for computed/function column refreshes.A shared
SeedCollectorhandles the same three steps in these writers:Seed collection uses the batches already being written; it does not require a separate scan.
New files, partial updates, and deletions
All writing paths above create new data files; they do not edit the old files in place. Seeds are stored inside the new file alongside the data they describe.
For a column rewrite, the fragment ID can stay the same. The affected column gets a replacement file; unrelated column files can be reused.
Updating only some rows still writes the complete affected column for that fragment:
The partial-update path reads the old column to preserve unchanged values. Seed collection observes the resulting output batches, so it adds no extra read for statistics. It does not merge old min/max with the changed values or overwrite seeds in the old file.
Deleting rows is different: changing the deletion vector leaves the stored column values unchanged, so existing file seeds need not be regenerated. Their min/max still contain all remaining values, though the bounds may become wider than necessary. Null counts describe physical file rows, not the exact number of nulls among the rows still visible after deletions.
What stays unchanged
use_seeds: falsestays off.Tests
Tests read the seeds directly from the new data files and compare them byte-for-byte with seeds generated from the current column values.
They cover append, full- and partial-fragment merge-insert updates, and a
write_columnsreplacement in a fragment containing multiple data files. They also check that unindexed columns and columns withuse_seeds: falsedo not get seeds.🤖 Generated with Claude Code