Repository navigation
docs(index): spec row-address domain for json, inverted, vector, ngram, rtree, minhash_lsh - #10299
Conversation
…m, rtree, minhash_lsh Stacked on #9481 (BTree) and #9814 (Bitmap/LabelList). Proposes the same migration for the remaining row-id-domain index types, bumping each format version and describing the new storage, gated the same way: a segment built on a stable-row-id dataset stores physical row addresses instead of logical row ids; a dataset without stable row ids keeps the pre-migration version since a row id and a row address coincide there. - Inverted (FTS): INVERTED_INDEX_VERSION_V3 -> V4, `_rowid` and posting list identifiers become row addresses. - NGram: NGRAM_INDEX_VERSION 0 -> 1, `posting_list` bitmap becomes row addresses. - R-Tree: RTREE_INDEX_VERSION 0 -> 1, leaf `id` and `nulls.lance` become row addresses. - MinHash LSH: minhash_lsh_index_version 0 -> 1, adds a normative "Version 1: Row-Address Domain" section describing the single change from Version 0. - Vector: VECTOR_INDEX_VERSION 1 -> 2 (FLAT/PQ/SQ/HNSW) and IVF_RQ_INDEX_VERSION 2 -> 3 (RQ), auxiliary file `_rowid` becomes a row address. - JSON: JSON_INDEX_VERSION 0 -> 1. Since the wrapper and its target are always built together, the wrapper's own version now records whether the wrapped target was built in the row-address domain, closing the gap noted in #9814 that blocks creating/optimizing a JSON-wrapped BTree/Bitmap/LabelList target in that domain. This is spec-only: no implementation changes. The goal is to align on the storage format before any of these index types are migrated. Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
Important Format specification voteThis PR modifies the Lance format specification, so it requires 3 binding +1 votes from PMC members (excluding the proposer), at least one of them on the latest commit, and a minimum 72-hour voting period, weekends excluded, before it can merge. Vote by approving this PR (+1) or requesting changes (−1, a veto). See the voting process. Approvals carry over across pushes, so a rebase or a typo fix does not send everyone back to re-vote. Whoever approves the latest commit is vouching that nothing substantive has changed since the earlier approvals; if something has, ask for fresh votes. Status: ✅ Vote passed — 4 PMC approvals, voting period elapsed
Updated automatically by the format-spec vote gate, which re-checks every 15 minutes — just voted? Re-check now (press Run workflow; leave the input blank to re-check every open format PR). A PMC member may apply the |
Fixes three issues flagged on the spec PR: - Vector: VectorIndexDetails doesn't record the quantization subtype, so a released reader's compatibility check accepts any vector segment up to the single global max_vector_version() (already 2, from IVF_RQ_INDEX_VERSION) for every subtype. Using version 2 for FLAT/PQ/SQ/HNSW's new address domain would therefore be silently accepted by readers that don't understand it. Use the next unused global level, 3, for every subtype instead (see #6097). - Inverted (FTS): the posting lists in invert.lance hold partition- local document IDs assigned at build time, not row ids/addresses -- a two-pass indirection through docs.lance that the previous wording collapsed. Only docs.lance._rowid changes domain; posting-list encoding is unaffected by this migration. - JSON: ZoneMap, BloomFilter, and FM targets are always address-domain regardless of version or dataset settings, so a version-0 JSON wrapper around one of them is already address-domain today. The new floor-version rule only applies to target types that actually migrate between domains (BTree, Bitmap, LabelList, and, once migrated, NGram, R-Tree, MinHash LSH). Also drops Inverted from the example target list, since JSON-path indexes explicitly reject it. Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The revision addresses all three earlier findings. The per-segment migration now preserves FTS document identity, legacy JSON target domains, and safe version rejection by released vector readers.
| scalar target whose `basic_trainer` accepts the extracted Arrow type, | ||
| including BTree, Bitmap, LabelList, ZoneMap, BloomFilter, FM, NGram, R-Tree, | ||
| and MinHash LSH. | ||
|
|
There was a problem hiding this comment.
Not sure if we want to keep this paragraph or not. I believe it to be true but it is also not essential to the PR.
Replaces the JSON_INDEX_VERSION-bump approach with a new JsonIndexDetails.target_index_version field, in response to feedback questioning why the wrapper's own version needed to change at all. Neither BTree, Bitmap, NGram, nor R-Tree self-describe their version inside their own files -- they're simply told their domain by the index_version their caller passes in (MinHash LSH, which stamps minhash_lsh_index_version into its own file metadata, is the exception). A JSON-wrapped target has no IndexMetadata entry of its own, so there was nowhere to recover that version from at load time other than the wrapper's single index_version field, which is why the previous revision overloaded it. Storing the target's version directly is simpler and more precise: JSON_INDEX_VERSION stays untouched (reserved for an actual future change to the wrapper layer), and an old reader's decision to skip a JSON index it doesn't fully understand is based on the embedded target plugin's own declared version, not a JSON-specific constant. Also adds a Version 1 schema example to minhash_lsh.md alongside the existing Version 0 one, making explicit that `_rowid` keeps its name across the migration (only the domain of its values changes, matching BTree's `ids` and Bitmap's `bitmaps` columns). Co-Authored-By: Claude Sonnet 5 <[email protected]>
_rowid is the name Lance uses elsewhere specifically for a column holding the dataset's logical row id, as distinct from _rowaddr for a physical row address. Once this column can hold either depending on minhash_lsh_index_version, keeping that name is misleading -- unlike BTree's "ids" or R-Tree's "id", which never claimed a specific domain to begin with. From format version 1, signatures.lance's row-identifier column is renamed _rowid -> id (version 0 is unaffected: a shipped format, still named _rowid). This is in addition to the domain change already proposed: rename and domain-retag land together at the same version boundary. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ot id Per feedback: use the specific, accurate name rather than a generic one. Unlike id, the rename to address is unconditional rather than a vague stand-in -- format version 1 is only ever written on a dataset with stable row ids enabled, which is exactly the condition under which a row id and a row address diverge, so the column genuinely and always holds an address whenever this version and column name appear. Co-Authored-By: Claude Sonnet 5 <[email protected]>
wjones127
left a comment
There was a problem hiding this comment.
Looks good, though I have one important question on the vector index doc.
Co-authored-by: Will Jones <[email protected]>
Co-authored-by: Will Jones <[email protected]>
PCA indices need a persisted projection so reopened queries use the same model as index construction. This specification defines how `lance:pca` locates the existing `PcaModel` protobuf in an `index.idx` global buffer, along with the projection, tensor layout, and dimensional constraints. Index metadata version 4 identifies PCA-enabled IVF_RQ indices so readers without PCA support skip them. Version 3 is already assigned to the row-address domain by #10299; PCA version 4 retains that domain, while indices without PCA keep their existing compatibility version. The model and this version contract are sufficient to identify PCA, without adding a manifest marker, training parameters, or a fingerprint. This PR changes only the format documentation. Build and query integration, including advertising version 4 as readable, belongs in a follow-up. Validation: - `make -C docs build` passed with placeholders for unavailable external repository docs and existing unrelated link warnings. - The final diff against merged `main` contains only the PCA documentation section; Rust and protobuf files match `main` exactly. Discussion: #9122 --------- Co-authored-by: beautygua <[email protected]> Co-authored-by: BubbleCal <[email protected]>
The row-address migration was specced at index_version 3 (#10299). Since then #10522 shipped IVF_HNSW_RQ at version 3, so the migration takes 4. PCA (#9968) had claimed 4 and described itself as retaining the domain "introduced by version 3", so it moves to 5. It is not wired into index creation, so no index records either number yet. Co-Authored-By: Claude Opus 5 <[email protected]>
Summary
Follow-on to #9481 (BTree → row-address domain) and #9814 (Bitmap/LabelList → row-address domain). Proposes the same migration for the remaining row-id-domain index types so we can align on the storage format before implementation begins. No implementation changes are included — this is docs/src/format only.
Each type follows the same gating rule already established by BTree/Bitmap/LabelList: a segment built on a dataset with stable row ids enabled stores physical row addresses (
fragment_id << 32 | offset) instead of the dataset's logical row id; without stable row ids a row id and a row address are the same value, so the pre-migration version is kept. This allows us to avoid a breaking index change on those older versions. Once we've established some runtime on the row-addr indexes we can trigger the upgrade for non-stable-row-id datasets as well (at that point we will hopefully have multiple releases of readers that can read the new version).INVERTED_INDEX_VERSION_V3→V4._rowidindocs.lanceand the delta-encoded posting-list identifiers become row addresses.NGRAM_INDEX_VERSION0 → 1.posting_listbitmap becomes row addresses.RTREE_INDEX_VERSION0 → 1. The leafidcolumn andnulls.lancebecome row addresses.minhash_lsh_index_version0 → 1. Adds a normative "Version 1: Row-Address Domain" section describing the single change from the existing Version 0 reference.VECTOR_INDEX_VERSION1 → 2 (FLAT/PQ/SQ/HNSW) andIVF_RQ_INDEX_VERSION2 → 3 (RQ). The auxiliary file's_rowidcolumn becomes a row address.JSON_INDEX_VERSION0 → 1. JSON is a wrapper with no files of its own, so instead of adding a new proto field, the wrapper's own segment version now records whether the wrapped target was built in the row-address domain (wrapper and target are always written by the same build, so this is sufficient). This closes the gap called out in feat(index): change bitmap and label_list scalar indexes to row-address domain #9814 that currently blocks creating or optimizing a JSON-wrapped BTree/Bitmap/LabelList target in the row-address domain on a stable-row-id dataset.Test plan
🤖 Generated with Claude Code