Skip to content

docs(format): add decimal:32 and decimal:64 logical types for Lance 2.3 - #11593

Merged
Xuanwo merged 5 commits into
lance-format:mainfrom
LuciferYang:docs/decimal32-64-spec
Nov 30, 2026
Merged

Xuanwo merged 5 commits into
lance-format:mainfrom
LuciferYang:docs/decimal32-64-spec

Conversation

@LuciferYang

@LuciferYang LuciferYang commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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

@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 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 Nov 28, 2026
@github-actions

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 ends Thu 2026-12-03 00:00 UTC (Wed 16:00 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 the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 28, 2026

@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 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_type documentation in protos/file.proto alongside 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.3 and 16.0.0-beta.5 failed to scan a table containing the new types even when projecting only id. An id-only append succeeded on 14.0.3 and 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.

@LuciferYang LuciferYang removed the format-waived Author attests no format vote is needed label Nov 28, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 28, 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 28, 2026
@LuciferYang

Copy link
Copy Markdown
Contributor Author

Thank you for testing this against 14.0.3 and 16.0.0-beta.5; the id-only append that wrote nulls is what a 2.3 gate alone would have missed. I agree with all three points and removed format-waived. The community discussion is in #5818, @wjones127's existing proposal for these types, and the vote stays on this PR.

  • The spec states the 2.3 minimum separately for standalone files (file version) and tables (data storage version), at any nesting depth, and file.proto lists both strings under Field.logical_type.
  • decimal:32 and decimal:64 require 0 ≤ S ≤ P; decimal:128 and decimal:256 keep allowing a negative scale, which implementations must round-trip.
  • A table with either type sets a paired, sticky flag, FLAG_DECIMAL32_AND_DECIMAL64 (2^23). Both releases you tested refuse bit 23 on read and write, and the bits survive drop, clone and restore.

#10431 and #10459 also claim bit 23; whichever lands later takes the next free bit.

@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 28, 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 28, 2026

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

@github-actions github-actions Bot added the A-encoding Encoding, IO, file reader/writer label Nov 28, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 28, 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 28, 2026

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

@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 30, 2026
@LuciferYang

Copy link
Copy Markdown
Contributor Author

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?

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

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

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

@Xuanwo Xuanwo added the format-waived Author attests no format vote is needed label Nov 30, 2026

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

Added as part of format 2.3

@Xuanwo
Xuanwo merged commit e39a54f into lance-format:main Nov 30, 2026
48 of 49 checks passed
xgbtxy added a commit to xgbtxy/lance that referenced this pull request Dec 2, 2026
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-encoding Encoding, IO, file reader/writer 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). format-waived Author attests no format vote is needed K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants