Repository navigation
feat: support Decimal32 and Decimal64 columns on data storage version 2.3 - #11594
Draft
LuciferYang wants to merge 3 commits into
Draft
LuciferYang wants to merge 3 commits into
LuciferYang wants to merge 3 commits into
Conversation
…hem in legacy files
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)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #5174 on top of the spec in #11593: Arrow
Decimal32andDecimal64columns are stored on data storage version 2.3 and rejected on earlier versions. Draft until the spec lands; the write-up follows once CI reports.🤖 Generated with Claude Code