Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
31a1187
feat: collect zone map write seeds for unindexed columns from dataset…
LuQQiu Nov 23, 2026
1e00abb
feat: validate zone write seed config when it is set
LuQQiu Nov 23, 2026
ec35041
fix: leave fixed-size binary columns out of configured zone write seeds
LuQQiu Nov 23, 2026
d2021bf
fix: validate zone write seed config on the composite commit path
LuQQiu Nov 23, 2026
6012095
test: drop the view-type case from the zone write seed type gate
LuQQiu Nov 23, 2026
23f9e97
feat: record null positions in configured zone write seeds
LuQQiu Nov 23, 2026
83102c1
Merge remote-tracking branch 'lance-format/main' into lu/zone-write-s…
LuQQiu Nov 23, 2026
9f63366
test: cover seed and index zone boundaries for configured write seeds
LuQQiu Nov 23, 2026
7198351
test: pin observed reuse counts in the seed boundary matrix
LuQQiu Nov 23, 2026
4405ba9
test: pin coarse-seed rejection and cover production zone sizes
LuQQiu Nov 23, 2026
60f25ad
test: type the expected reuse counts in the real-size boundary test
LuQQiu Nov 23, 2026
ae859f3
test: compare stored zone statistics with a generator oracle
LuQQiu Nov 23, 2026
35bd435
test: require fragment-local zone starts in the stored statistics oracle
LuQQiu Nov 23, 2026
bda2e55
test: cover seed boundaries per type with and without a null bitmap i…
LuQQiu Nov 23, 2026
cec0853
test: compare typed zone bounds through array equality
LuQQiu Nov 23, 2026
759eeba
test: extend the per-type seed boundary test to every round-trip type
LuQQiu Nov 23, 2026
0b403f4
test: cover the remaining configured-seed types in the boundary oracle
LuQQiu Nov 23, 2026
33ca06a
Merge upstream/main into lu/zone-write-seeds-config-main
LuQQiu Nov 30, 2026
3fa6992
refactor: read the configured seed zone size from the manifest in bin…
LuQQiu Nov 30, 2026
45aa04e
fix: let unknown keys under the zone write seeds prefix pass validation
LuQQiu Nov 30, 2026
7785279
docs: list zone write seed keys in the table config spec
LuQQiu Dec 1, 2026
e8cc2ab
Merge branch 'main' into lu/zone-write-seeds-config
LuQQiu Dec 2, 2026
7ec156b
feat: seed fixed-size binary columns from the table config
LuQQiu Dec 2, 2026
fc47019
docs: state when an index build reads configured zone write seeds
LuQQiu Dec 2, 2026
6681376
fix: validate zone write seed settings on the same condition in both …
LuQQiu Dec 2, 2026
a61778b
docs: leave seeded column types to the writer and state config rules …
LuQQiu Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions docs/src/format/index/scalar/zone_write_seeds.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,29 @@ divided into zones, normally 8,192 rows each, with one statistics record per zon
The table layer can use these statistics for zone pruning, aggregate them for
fragment or index segment pruning, or build an index without rereading the column.

This proposal defines version 1 seeds. It does not change the ZoneMap index format
or enable version 1 writes; implementation follows separately.
This proposal defines version 1 seeds. It does not change the ZoneMap index format.
Writers emit version 1 seeds once a table opts in through
`lance.zone_write_seeds.version` (see
[Reader and writer compatibility](#reader-and-writer-compatibility)).

## Table configuration

Columns with a seeded ZoneMap index (`use_seeds=true`) get the seeds that index
requests. Other columns are seeded only when the table sets
`lance.zone_write_seeds.enabled`, with zone size and null-position collection
controlled by `lance.zone_write_seeds.rows_per_zone` and
`lance.zone_write_seeds.store_null_bitmap`. These keys only choose which
columns are seeded; the seed version follows `lance.zone_write_seeds.version`.
Which column types are seeded is up to the writer. A writer may also skip
configured seeds in the write that creates the dataset, in an overwrite, for data
files in the legacy file format, or for a column whose seed another index type
provides.
An index build reads these seeds only when the index uses seeds. An index created
without an explicit `use_seeds` takes the default for the column's type: `false`
for fixed-width types of 8 bytes or less, so reusing the configured seeds for those
columns requires creating the index with `use_seeds=true`, and `true` for
variable-length and wider types.
See [Table Config](../../table/table_config.md) for types and defaults.

## Arrow Rust ordering

Expand Down Expand Up @@ -101,4 +122,8 @@ Activation is explicit, not triggered by opening a table. Both bits remain set
in derived snapshots, including clone and restore, even after dropping an index.
Historical snapshots are unchanged; version 0 and version 1 seeds may coexist.

The bit remains reserved and unsupported until runtime support is implemented.
A commit that explicitly writes `lance.zone_write_seeds.version = 1` sets
`FLAG_ZONE_WRITE_SEEDS` in both `reader_feature_flags` and
`writer_feature_flags`; an inherited `1` does not. Once set, the flag stays set
and writers emit version 1 seeds unless the key is explicitly `0`. Without the
flag, writers emit version 0 seeds.
17 changes: 17 additions & 0 deletions docs/src/format/table/table_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,24 @@ full set of metadata maps.
| `lance.compaction.max_source_rows` | Non-negative integer | Maximum number of live source rows (physical rows minus soft-deleted rows) to compact in a single run. Defaults to unlimited. |
| `lance.compaction.max_source_bytes` | Non-negative integer | Maximum number of source bytes (data files and [data overlay files](data_overlay_file.md), excluding blob v2 payloads) to compact in a single run. Defaults to unlimited. |
| `lance.compaction.max_overlays_per_fragment` | Non-negative integer or `none` | Maximum number of [data overlay files](data_overlay_file.md) a fragment may carry before it is fully compacted (overlays and deletions materialized into the base data). Defaults to `10`. Set to `0` to compact every fragment with any overlay, or `none` to disable the trigger. |
| `lance.zone_write_seeds.enabled` | Boolean (`true`/`false`) | If `true`, writers should collect a [zone write seed](../index/scalar/zone_write_seeds.md) for top-level scalar columns that no seeded index already covers, so a ZoneMap index created later can be built from seeds instead of rescanning. Which column types get seeds is up to the writer. Columns covered by a ZoneMap index with `use_seeds=true` keep that index's settings. An index build reads these seeds only when the index uses seeds. Defaults to `false`. |
| `lance.zone_write_seeds.rows_per_zone` | Integer (1 to 4,294,967,295) | Rows per seed zone for the columns seeded because of `lance.zone_write_seeds.enabled`. Defaults to `8192`. |
| `lance.zone_write_seeds.store_null_bitmap` | Boolean (`true`/`false`) | Whether the seeds collected because of `lance.zone_write_seeds.enabled` record null positions, so they can serve a ZoneMap index that stores a null bitmap. With `false`, those seeds only serve indices that store no null bitmap. Defaults to `true`. |
| `lance.zone_write_seeds.version` | `0` or `1` | [Zone write seed](../index/scalar/zone_write_seeds.md) format version. A commit that itself writes `1` sets `FLAG_ZONE_WRITE_SEEDS` in both feature flag words; an inherited `1` does not. Once set, the flag stays set and writers emit version 1 seeds unless this key is explicitly `0`. Without the flag, writers emit version 0 seeds. Unset by default. |

</div>

Unrecognized `lance.compaction.*` keys are ignored with a warning; unrecognized keys under other `lance.*` prefixes should likewise be ignored by conforming readers rather than treated as errors.

Zone write seeds are optional metadata. An implementation that does not write
seeds must preserve every `lance.zone_write_seeds.*` key. `enabled`,
`rows_per_zone`, and `store_null_bitmap` only choose which seeds a writer
collects: they must not change what readers need to understand, and must not
set [`FLAG_ZONE_WRITE_SEEDS`](versioning.md#current-feature-flags). Like any
table configuration, they are covered by the
[`FLAG_TABLE_CONFIG`](versioning.md#current-feature-flags) writer flag that a
non-empty table config sets. The seed version a writer emits, and whether
`FLAG_ZONE_WRITE_SEEDS` is set, must depend only on
`lance.zone_write_seeds.version`. A commit that sets one of these keys to an
invalid value must be rejected. Unknown keys under the
`lance.zone_write_seeds.` prefix must be preserved, not rejected.
10 changes: 8 additions & 2 deletions rust/lance-table-runtime/src/optimize/binary_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ pub async fn rewrite_files_binary_copy(
Some(hook) => hook.index_rows_per_zone(dataset).await?,
None => Default::default(),
};
let unindexed_rows_per_zone =
lance_table::feature_flags::ZoneWriteSeedsConfig::from_config(&dataset.manifest.config)
.map_or(
lance_table::format::index_seed::ROWS_PER_ZONE_DEFAULT,
|config| config.rows_per_zone,
);

// Visit each fragment and all of its data files (a fragment may contain multiple files)
for frag in fragments.iter() {
Expand Down Expand Up @@ -390,7 +396,7 @@ pub async fn rewrite_files_binary_copy(
total_rows_in_current += file_meta.num_rows;
if total_rows_in_current >= max_rows_per_file {
let output_seeds = if carry_v1_seeds {
seed_acc.finish(&schema, &index_rows_per_zone)?
seed_acc.finish(&schema, &index_rows_per_zone, unindexed_rows_per_zone)?
} else {
seed_acc.clear();
Vec::new()
Expand Down Expand Up @@ -428,7 +434,7 @@ pub async fn rewrite_files_binary_copy(
init_writer_if_necessary(dataset, version, &mut current_writer, &mut current_filename)
.await?;
let output_seeds = if carry_v1_seeds {
seed_acc.finish(&schema, &index_rows_per_zone)?
seed_acc.finish(&schema, &index_rows_per_zone, unindexed_rows_per_zone)?
} else {
seed_acc.clear();
Vec::new()
Expand Down
23 changes: 14 additions & 9 deletions rust/lance-table-runtime/src/optimize/binary_copy/seed_carry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use lance_file::versions::data_file_columns;
use lance_io::scheduler::FileScheduler;
use lance_table::format::DataFile;
use lance_table::format::index_seed::{
CarriedSeed, MergeableSeed, ROWS_PER_ZONE_DEFAULT, SEED_META_KEY_PREFIX,
merge_seeds_for_binary_copy, parse_seed_for_binary_copy,
CarriedSeed, MergeableSeed, SEED_META_KEY_PREFIX, merge_seeds_for_binary_copy,
parse_seed_for_binary_copy,
};

use lance_core::{Result, datatypes::Schema};
Expand All @@ -38,10 +38,11 @@ pub enum SourceColumnSeed {
}

/// The `rows_per_zone` an output column's locator declares: the current
/// index specification for the column when one exists, else the writer
/// default. It is write-time configuration; zones are located by length.
pub fn output_rows_per_zone(index_rows_per_zone: Option<u64>) -> u64 {
index_rows_per_zone.unwrap_or(ROWS_PER_ZONE_DEFAULT)
/// seeded index specification for the column when one exists, else
/// `unindexed_rows_per_zone`. It is write-time configuration; zones are
/// located by length.
pub fn output_rows_per_zone(index_rows_per_zone: Option<u64>, unindexed_rows_per_zone: u64) -> u64 {
index_rows_per_zone.unwrap_or(unindexed_rows_per_zone)
}

/// The validated seeds of one input file, keyed by field id. An input with no
Expand Down Expand Up @@ -212,15 +213,16 @@ impl OutputSeedAccumulator {
/// A column is kept only when every input carries a version 1 seed of one
/// value type; zones are located by length, so differing collection
/// granularities concatenate freely and the output locator declares the
/// column's current `rows_per_zone` from `index_rows_per_zone` (or the
/// writer default). Each column is decided on its own: an input without
/// column's current `rows_per_zone` from `index_rows_per_zone` (or
/// `unindexed_rows_per_zone`). Each column is decided on its own: an input without
/// a seed, with a version this build cannot interpret, or with a version
/// 0 seed drops that column (no conversion or relabeling), and the data
/// still copies.
pub fn finish(
&mut self,
current_schema: &Schema,
index_rows_per_zone: &HashMap<i32, u64>,
unindexed_rows_per_zone: u64,
) -> Result<Vec<OutputSeed>> {
let sources = std::mem::take(&mut self.sources);
let Some(first) = sources.first() else {
Expand Down Expand Up @@ -295,7 +297,10 @@ impl OutputSeedAccumulator {
};
output.push(OutputSeed {
column_name: current_field.name.clone(),
rows_per_zone: output_rows_per_zone(index_rows_per_zone.get(field_id).copied()),
rows_per_zone: output_rows_per_zone(
index_rows_per_zone.get(field_id).copied(),
unindexed_rows_per_zone,
),
bytes,
});
}
Expand Down
Loading
Loading