Skip to content

docs(index): spec row-address domain for json, inverted, vector, ngram, rtree, minhash_lsh - #10299

Merged
westonpace merged 11 commits into
mainfrom
claude/index-spec-row-addresses-59e6ff
Oct 29, 2026
Merged

westonpace merged 11 commits into
mainfrom
claude/index-spec-row-addresses-59e6ff

Conversation

@westonpace

@westonpace westonpace commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

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 (FTS): INVERTED_INDEX_VERSION_V3 → V4. _rowid in docs.lance and the delta-encoded 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. The leaf id column 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 the existing Version 0 reference.
  • Vector: VECTOR_INDEX_VERSION 1 → 2 (FLAT/PQ/SQ/HNSW) and IVF_RQ_INDEX_VERSION 2 → 3 (RQ). The auxiliary file's _rowid column becomes a row address.
  • JSON: JSON_INDEX_VERSION 0 → 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

  • Docs-only change; no code affected.
  • Review and discussion on the proposed version numbers and storage descriptions before implementation PRs are opened per index type.

🤖 Generated with Claude Code

…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]>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added A-format On-disk format: protos and format spec docs format-change A change to the format spec, which requires a vote. Remove if minor (e.g. fixing typo). documentation Improvements or additions to documentation labels Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

Format specification vote

This 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

Approvals @Xuanwo, @jackye1995, @wjones127, @BubbleCal (4/3)
Latest commit approved by @wjones127, @BubbleCal
Vetoes none
Voting period elapsed — ended Wed 2026-10-28 22:15 UTC (15:15 PDT)

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 format-waived label to waive the vote for a trivial edit (typo, wording, formatting).

lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Oct 23, 2026
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]>
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Oct 26, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

Comment thread docs/src/format/index/scalar/json.md Outdated
scalar target whose `basic_trainer` accepts the extracted Arrow type,
including BTree, Bitmap, LabelList, ZoneMap, BloomFilter, FM, NGram, R-Tree,
and MinHash LSH.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 26, 2026
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]>
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 26, 2026
westonpace and others added 5 commits October 26, 2026 10:23
_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 wjones127 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, though I have one important question on the vector index doc.

Comment thread docs/src/format/index/scalar/json.md Resolved
Comment thread docs/src/format/index/scalar/ngram.md Resolved
Comment thread docs/src/format/index/scalar/rtree.md Resolved
Comment thread docs/src/format/index/scalar/rtree.md Resolved
Comment thread docs/src/format/index/vector/index.md Resolved
@westonpace
westonpace merged commit 65df9b7 into main Oct 29, 2026
6 checks passed
@westonpace
westonpace deleted the claude/index-spec-row-addresses-59e6ff branch October 29, 2026 00:19
BubbleCal added a commit that referenced this pull request Oct 29, 2026
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]>
westonpace added a commit that referenced this pull request Dec 1, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-format On-disk format: protos and format spec docs documentation Improvements or additions to documentation format-change A change to the format spec, which requires a vote. Remove if minor (e.g. fixing typo).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants