Repository navigation
docs(format): add decimal:32 and decimal:64 logical types for Lance 2.3 - #11593
Conversation
…orage version 2.3
|
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 |
There was a problem hiding this comment.
AI-assisted technical review of 0f8b8912
The CI build from #11594 writes decimal:32:9:2 and decimal:64:18:4 into Field.logical_type in both table manifests and standalone files. Reusing the existing physical encodings still requires readers to recognize two new logical types. Please take the proposal through the normal community discussion and PMC format process.
Three points need clarification before the specification is ready:
- State the 2.3 minimum for both standalone files and tables, including nested fields. Update the
Field.logical_typedocumentation inprotos/file.protoalongside the schema table. - Make explicit that the new widths enforce
0 ≤ S ≤ P. Existing clients round-trip negative scales for Decimal128 and Decimal256; preserve that behavior for the wider types. - Document what applications can rely on when clients with different capabilities share a table. Both
14.0.3and16.0.0-beta.5failed to scan a table containing the new types even when projecting onlyid. Anid-only append succeeded on14.0.3and produced null decimal fields, while the beta rejected it. Selecting 2.3 alone therefore does not establish that every participating client can read the table or that every older writer will reject a commit.
|
Thank you for testing this against 14.0.3 and 16.0.0-beta.5; the
#10431 and #10459 also claim bit 23; whichever lands later takes the next free bit. |
Xuanwo
left a comment
There was a problem hiding this comment.
AI-assisted technical review of bcaf20c7
The spec now states the 2.3 minimum for standalone files and tables at any nesting depth, the sticky paired reader/writer flag, and negative-scale support for Decimal128 and Decimal256. These address the compatibility questions from the previous review.
The protobuf check reports stale checked-in Rust generated from file.proto. table.proto also changed. Please regenerate the affected Rust sources using the project workflow so the generated comments match the specification. Protobuf check
Xuanwo
left a comment
There was a problem hiding this comment.
AI-assisted technical review of 4eaa7fa2
Only generated Rust comments changed since bcaf20c7. The checked-in sources now match file.proto and table.proto, and the protobuf check passes. The 2.3 version requirements, scale rules, and paired reader/writer flag address the compatibility questions raised earlier. Protobuf check
#10431 and #10459 also propose bit 23. Whichever proposal lands later needs a distinct free bit in both its specification and its implementation.
|
Thank you for the review. Agreed on bit 23: whichever proposal lands later moves both its spec and its implementation to a free bit, and for this one that includes #11594. I went over the spec once more and made a few changes. Could you take another look?
|
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The author’s clarification matches the code: bit 23 is reserved while remaining unsupported for both reads and writes, so the contract can land before runtime support in #11594. The clarified 2.3 minimum covers standalone files, tables, nested fixed-size lists, and index files. Invalid schemas must be rejected; paired flags remain sticky through overwrite, restore, and clone. Decimal128/256 retain negative-scale support down to -128. Protection against older clients depends on feature-flag enforcement.
Bit 23 has no other allocation on the current base. #10431 and #10459 still propose it, so whichever lands later must use a distinct free bit consistently across its specification, reservation, and implementation.
Xuanwo
left a comment
There was a problem hiding this comment.
AI-assisted technical re-review of 39e7bd9
Bit 23 is reserved and unsupported for both reading and writing. A half-set pair is invalid. The specification now covers nested fixed_size_list elements and index files. ARM passed test_decimal32_and_decimal64_flag_is_reserved. The PMC vote remains open.
… 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.
Adds two logical types to the table schema spec,
decimal:32:P:Sfor ArrowDecimal32anddecimal:64:P:Sfor ArrowDecimal64. 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:128anddecimal:256("Only Decimal128 and Decimal256 is supported"). So, for a field of either type at any nesting depth, including inside afixed_size_list:Manifest.data_format.version) 2.3 or later and set the new feature flagFLAG_DECIMAL32_AND_DECIMAL64(2^23) in bothreader_feature_flagsandwriter_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.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_UNKNOWNis1 << 18in 14.0.3 and1 << 23in 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_UNKNOWNto 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
Decimal32and 1-18 forDecimal64, as in Arrow. These two widths require0 ≤ S ≤ P. The existing rule fordecimal:128anddecimal:256said0 ≤ 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_UNKNOWNand implementation) and have their approvals re-confirmed.🤖 Generated with Claude Code