Skip to content

feat(format): reserve a writer flag for versioned inverted indices - #10459

Open
xgbtxy wants to merge 7 commits into
lance-format:mainfrom
xgbtxy:spec/fts-writer-feature-9670
Open

xgbtxy wants to merge 7 commits into
lance-format:mainfrom
xgbtxy:spec/fts-writer-feature-9670

Conversation

@xgbtxy

@xgbtxy xgbtxy commented Oct 29, 2026 •

Copy link
Copy Markdown

Summary

Reserve writer-only bit 25, FLAG_VERSIONED_INVERTED_INDEX, for snapshots containing an inverted index segment with IndexMetadata.index_version >= 3.

Refs #9670. A Pylance 8.0.1 writer can load a newer dataset, filter out an unsupported FTS index, and commit an append without that index's metadata. This proposal defines the compatibility boundary that makes such a writer refuse the dataset before committing.

Format contract

  • Set the bit atomically with the affected index metadata, using the complete index section for ordinary commits, maintenance, clone, and restore. Preserve unsupported segments or refuse the operation. Clear the bit only when no affected segment remains.
  • Match the inverted index type and its declared IndexMetadata version, independently of posting_format_version. Other index types at version 3 are unaffected.
  • Leave reader flags unchanged. A client can still read supported data and indexes, but must recognize this capability before writing. This also excludes older writers that can read v3 FTS but do not know the new flag.
  • Existing unflagged snapshots and stale handles are not retroactively protected, and historical unflagged v3 FTS manifests remain valid on read; deployments must upgrade or stop incompatible writers before activation.

The proposal originally targeted bit 20, moved to bit 23 (1 << 23) in fffc0323, and moved to bit 25 (1 << 25) in 106e4691 after merging main through #11593 (which reserved bit 23 for FLAG_DECIMAL32_AND_DECIMAL64), leaving bit 24 free for pending #10431 (FLAG_INDEX_PREDICATES) so both proposals reserve distinct bits.

Validation

  • Reproduced the unflagged index loss using official Pylance 8.0.1, 13.0.0, and 14.0.2 wheels.
  • On isolated copies, selected the latest manifest by its decoded version and changed only its writer feature word to a reserved writer flag bit (originally tested with 1 << 20; any unknown writer bit exercises the same unrecognized-writer-flag rejection path). Both Dataset.insert and write_dataset(mode="append") refused before commit on 8.0.1 and 14.0.2. Version and rows stayed unchanged; 14.0.2 could still query the FTS index after every attempt. This is a synthetic compatibility probe, not an implemented writer change.
  • A standalone probe, commands, and results are available separately from this format-only diff.
  • Compiled all 15 protobuf schemas before and after the proposal. Descriptors excluding source comments are byte-identical; no protobuf field or wire layout changes.
  • Proto comment-style check (ci/check_proto_comments.py) passes on the updated protos/table.proto, and the repository's pinned pre-commit hooks passed on the initial proposal commit 98244d2b86c6ebc67d7ef15ae8d399187dff5981.

Scope

This is the format proposal for PMC review under the format voting process. It changes only the specification and matching protobuf comments. Runtime flag support, regression tests, and the migration-guide warning will follow after the contract is accepted; this PR does not close the runtime bug.

AI assistance: OpenAI Codex assisted with investigation, drafting, and validation. The commit includes an Assisted-by trailer.

Specify writer-only bit 20 for inverted index segments whose declared
IndexMetadata version is at least 3. Require complete index metadata to be
preserved across manifest publications or the write to be refused.

Keep reader capability checks separate and document the upgrade and
historical-snapshot limitations. Runtime support follows the format vote.

Refs: lance-format#9670
Assisted-by: OpenAI Codex (GPT-6)
Copilot AI balanced review requested due to automatic review settings October 29, 2026 14:42

@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 pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added enhancement New feature or request 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). labels Oct 29, 2026

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions

github-actions Bot commented Oct 29, 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: ❌ Blocked — 0 of 3 required approvals

Approvals none (0/3)
Latest commit approved by none — one PMC member must approve the latest commit
Vetoes none
Voting period elapsed — ended Tue 2026-11-03 14:42 UTC (06:42 PST)

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 K-approved Latest Gatekeeper recommendation permits acceptance. and removed K-approved Latest Gatekeeper recommendation permits acceptance. labels Oct 29, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 11, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 11, 2026
@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 14, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 14, 2026
@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 25, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 25, 2026
@lance-gatekeeper lance-gatekeeper Bot added the K-risk Latest Gatekeeper recommendation includes a non-blocking risk. label Nov 25, 2026
Comment thread protos/table.proto Resolved
@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 25, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 25, 2026
…ters

Match versioning.md by clarifying that writers implementing
FLAG_VERSIONED_INVERTED_INDEX must set writer feature flag 1 << 23 when
publishing a new manifest, while historical unflagged manifests remain
valid on read, and regenerate rust/lance-table/src/pb/lance.table.rs.
@xgbtxy

xgbtxy commented Nov 25, 2026

Copy link
Copy Markdown
Author

Thanks for the review @Xuanwo. Both items are now addressed:

  1. protos/table.proto & regenerated rust/lance-table/src/pb/lance.table.rs (9e11e40): scoped the IndexMetadata.index_version note to writers implementing FLAG_VERSIONED_INVERTED_INDEX when publishing a new manifest, and clarified that historical unflagged manifests remain valid on read (matching versioning.md; both ci/check_proto_comments.py and protos/codegen --check pass).
  2. Updated the PR summary to reflect writer bit 23 (1 << 23).

@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 25, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 25, 2026
Xuanwo pushed a commit that referenced this pull request Nov 30, 2026
….3 (#11593)

Adds two logical types to the table schema spec, `decimal:32:P:S` for
Arrow `Decimal32` and `decimal:64:P:S` for Arrow `Decimal64`. This is
the spec half of #5174 and follows wjones127's proposal in #5818; the
standalone-file gate, the flag and the scale rules came out of Xuanwo's
review here. The implementation is #11594.

Released Lance versions parse only `decimal:128` and `decimal:256`
("Only Decimal128 and Decimal256 is supported"). So, for a field of
either type at any nesting depth, including inside a `fixed_size_list`:

- A Lance file, index files included, must use file version 2.3 or
later.
- A table must have data storage version
(`Manifest.data_format.version`) 2.3 or later and set the new feature
flag `FLAG_DECIMAL32_AND_DECIMAL64` (`2^23`) in both
`reader_feature_flags` and `writer_feature_flags`. Every commit whose
schema has such a field sets both bits, and dropping the field,
overwriting, restoring or cloning does not clear them.
- Readers reject as invalid a file below 2.3 that has such a field, and
a manifest that has one with a data storage version below 2.3 or without
both bits.

The flag keeps out older clients that enforce feature flags. In Xuanwo's
review, 14.0.3 and 16.0.0-beta.5 failed to scan a table with these types
and no flag, even when projecting only other columns, and 14.0.3
appended rows that left the new fields null. Both builds refuse any
table with bit 23 set, on read and on write: `FLAG_UNKNOWN` is `1 << 18`
in 14.0.3 and `1 << 23` in 16.0.0-beta.5.

As with bit 22 in #10358, this PR reserves the bit: it adds the constant
and its half-set check, moves `FLAG_UNKNOWN` to bit 24 and keeps bit 23
unsupported. #11594 turns it on, and I will open a small docs PR marking
it supported once #11594 merges.

Neither type needs a new physical layout: both are fixed-width 32- and
64-bit values that 2.3 already encodes. Precision is 1-9 for `Decimal32`
and 1-18 for `Decimal64`, as in Arrow. These two widths require `0 ≤ S ≤
P`. The existing rule for `decimal:128` and `decimal:256` said `0 ≤ S ≤
P`, although Lance accepts a negative scale for them; this PR changes it
to `-128 ≤ S ≤ P`.

#10431 and #10459 also claim bit 23. Whichever of the three merges first
keeps it. The others move to a free bit everywhere they use 23 (spec and
protos, plus any constant, `FLAG_UNKNOWN` and implementation) and have
their approvals re-confirmed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

@Xuanwo Xuanwo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

AI-assisted technical review of 9e11e404

The spec still assigns writer bit 23 to FLAG_VERSIONED_INVERTED_INDEX. Main now reserves that bit for FLAG_DECIMAL32_AND_DECIMAL64 (#11593). Please rebase and coordinate with #10431 on a free writer bit distinct from the predicate flag. Keep the spec, protobuf comments, generated text, and corresponding implementation aligned. Merged flag assignment

… move flag bit to 2^25

Upstream main reserved bit 23 for FLAG_DECIMAL32_AND_DECIMAL64 (lance-format#11593), and pending lance-format#10431 reserves bit 24 for FLAG_INDEX_PREDICATES. Coordinate on distinct writer bit 25 (1 << 25) across docs/src/format/table/versioning.md, protos/table.proto, and rust/lance-table/src/pb/lance.table.rs.
@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Dec 2, 2026
@xgbtxy

xgbtxy commented Dec 2, 2026

Copy link
Copy Markdown
Author

Thanks @Xuanwo and @Ali2Arslan! Updated in 106e4691:

  • Merged main through docs(format): add decimal:32 and decimal:64 logical types for Lance 2.3 #11593 (e39a54f3), preserving bit 23 for FLAG_DECIMAL32_AND_DECIMAL64.
  • Moved FLAG_VERSIONED_INVERTED_INDEX to writer bit 25 (2^25 / 1 << 25) across docs/src/format/table/versioning.md, protos/table.proto, rust/lance-table/src/pb/lance.table.rs, and the PR summary, leaving bit 24 open for feat(format): specify index predicates #10431 (FLAG_INDEX_PREDICATES) as proposed.
  • This PR remains format-spec and protobuf-comment reservation only (no Rust constant in feature_flags.rs yet; main already rejects bit 25 via FLAG_UNKNOWN = 1 << 24), and the follow-up implementation PR will align with 1 << 25.

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

Verified the author's update: bit 25 agrees across the specification, protobuf comments, generated binding, and PR summary. It is distinct from Decimal32/Decimal64 at bit 23 and pending #10431 at bit 24, resolving the earlier allocation risk.

The writer-only capability remains appropriate for the released-client index-loss path in #9670. This format reservation is ready to accept. Runtime enforcement and regression tests remain follow-up work before activation; deployments must upgrade or stop incompatible writers, including long-lived writers opened before activation.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 2, 2026

This branch has not been deployed

No deployments
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 enhancement New feature or request format-change A change to the format spec, which requires a vote. Remove if minor (e.g. fixing typo). K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants