Repository navigation
feat(format): specify index predicates - #10431
Ali2Arslan wants to merge 6 commits into
Conversation
Co-authored-by: Cursor <[email protected]>
|
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: ❌ Blocked — 0 of 3 required approvals
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 |
Co-authored-by: Cursor <[email protected]>
Main assigned bit 18 to FLAG_ROW_ADDR_INDICES and bit 19 to FLAG_INLINE_DELETIONS. Move FLAG_INDEX_PREDICATES to bit 21 with FLAG_UNKNOWN at bit 22, and leave bit 20 masked as unsupported for the pending composite B-tree key layout flag, as bit 18 was before. Main now checks in the generated protobuf sources, so regenerate rust/lance-table/src/pb/lance.table.rs for IndexMetadata.predicate and IndexPredicate. Main also added a feature flag name table to lance-tools, so name the new flag there. Co-authored-by: Cursor <[email protected]>
|
Merged main. Main has since assigned bit 18 to |
Main assigned bit 20 to FLAG_LOCAL_FRAGMENT_ALIASES, bit 21 to FLAG_DELETION_FILE_PATHS, and IndexMetadata field 14 to local_fragment_aliases. Move FLAG_INDEX_PREDICATES to bit 23 with FLAG_UNKNOWN at bit 24, and move IndexMetadata.predicate to field 15. Bit 22 stays masked as unsupported for the pending composite B-tree key layout flag. Name index_predicates after main's new flag names in lance-tools, and keep main's flags, asserts, and tests, updating its FLAG_UNKNOWN assertions to bit 24. Co-authored-by: Cursor <[email protected]>
Main now assigns bit 22 to FLAG_BTREE_KEY_LAYOUT with FLAG_UNKNOWN at bit 23. Keep FLAG_INDEX_PREDICATES at bit 23, move FLAG_UNKNOWN to bit 24, and drop the raw bit 22 mask, which FLAG_BTREE_KEY_LAYOUT now covers. Name index_predicates after btree_key_layout in lance-tools, and list bit 23 as reserved with bits 24 and above unknown in versioning.md. Co-authored-by: Cursor <[email protected]>
|
Merged main again. Main now assigns bit 20 to |
….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
left a comment
There was a problem hiding this comment.
AI-assisted technical review of 2065c44e
Main now reserves bit 23 in both the reader and writer flags for FLAG_DECIMAL32_AND_DECIMAL64 (#11593). The spec, Rust constant, and assertions here still use bit 23 for FLAG_INDEX_PREDICATES. Please rebase and coordinate with #10459 on distinct free bits for the two proposals, then update the predicate spec, constant, and assertions together. Merged flag assignment
Main now assigns bit 23 to FLAG_DECIMAL32_AND_DECIMAL64 with FLAG_UNKNOWN at bit 24. Move FLAG_INDEX_PREDICATES to bit 24 and FLAG_UNKNOWN to bit 25, and update main's FLAG_UNKNOWN assertions to match. IndexMetadata.predicate stays field 15. Name index_predicates after decimal32_and_decimal64 in lance-tools, and list bit 24 as reserved with bits 25 and above unknown in versioning.md. Co-authored-by: Cursor <[email protected]>
|
Merged main again. Main now assigns bit 23 to @xgbtxy, #10459 also claims bit 23, for |
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The merge update moves predicates to bit 24, avoiding the merged Decimal32/Decimal64 allocation. Protobuf field 15 and the predicate contract are unchanged; both readers and writers continue to reject the reserved capability.
… 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.
Why
Some queries touch only a subset of rows, such as the embeddings where
rejected = true. This PR specifies the persisted format for index predicates, which restrict a scalar or vector index to the rows where a boolean expression is TRUE. It reserves the protobuf field and feature flag ahead of the implementation so voters can review the format contract on its own.What changed
IndexMetadatagainsoptional IndexPredicate predicate = 15, andtable.protodefinesIndexPredicate { bytes substrait = 1; repeated int32 fields = 2; }. The expression is a SubstraitExtendedExpressionholding one boolean expression whose base schema columns bind by position to top-level field IDs (fields[i]), so column renames do not change the stored predicate. Main uses field 14 forlocal_fragment_aliases.FLAG_INDEX_PREDICATES(1 << 24) as a paired reader and writer feature flag infeature_flags.rsand keep it masked out insupported_flags_whenuntil implemented. Main already assigns bit 20 toFLAG_LOCAL_FRAGMENT_ALIASESand bit 21 toFLAG_DELETION_FILE_PATHS. K1 (docs(format): specify composite B-tree keys #10358) merged and owns bit 22 asFLAG_BTREE_KEY_LAYOUT, and docs(format): add decimal:32 and decimal:64 logical types for Lance 2.3 #11593 assigns bit 23 toFLAG_DECIMAL32_AND_DECIMAL64.fields ∪ covering_fields ∪ predicate.fields).Scope
IndexMetadata.predicateorFLAG_INDEX_PREDICATESyet.FLAG_INDEX_PREDICATESset instead of treating a partial index as covering every row or dropping its predicate on the next commit.Blast Radius
Existing manifests do not set
IndexMetadata.predicateor bit 24, so wire decoding and feature-flag checks for existing datasets are unchanged.Testing
python3 ci/check_proto_comments.pypython3 ci/check_module_size.py origin/maincargo fmt --all -- --checkcargo test -p lance-table feature_flags --libcargo test -p lance-table format::index --libRUSTDOCFLAGS='-D warnings' cargo doc -p lance-table --no-depscargo clippy --all --tests --benches -- -D warningscd docs && uv run mkdocs build