-
Notifications
You must be signed in to change notification settings - Fork 2k
[Feature] Support write and read decimal256 #59778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
7d46e44
to
0a76af8
Compare
Closed
6b14595
to
00e5b92
Compare
13bfac7
to
f993d98
Compare
22 tasks
f993d98
to
e3e26a1
Compare
satanson
previously approved these changes
Jun 13, 2025
24fbea7
to
1a1ce00
Compare
Signed-off-by: stephen <stephen5217@163.com>
1a1ce00
to
435b407
Compare
|
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 7 / 8 (87.50%) file detail
|
[BE Incremental Coverage Report]❌ fail : 48 / 77 (62.34%) file detail
|
satanson
approved these changes
Jun 16, 2025
Seaven
approved these changes
Jun 16, 2025
kangkaisen
approved these changes
Jun 16, 2025
AntiTopQuark
pushed a commit
to AntiTopQuark/starrocks
that referenced
this pull request
Jun 19, 2025
Signed-off-by: stephen <stephen5217@163.com> Signed-off-by: AntiTopQuark <AntiTopQuark1350@outlook.com>
dengliu
pushed a commit
to dengliu/starrocks
that referenced
this pull request
Jun 20, 2025
Signed-off-by: stephen <stephen5217@163.com>
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.
Why I'm doing:
What I'm doing:
the changes of this PR are all to ensure that decimal256 can be correctly compiled and read-written. some traits aren't implemented yet because we need other features to test them. the main change of this patch is that we define int256 as the storage for decimal256. This PR is only the simplest version for int256 arithmetic operations. We will optimize it in the subsequent PR.
Currently, StarRocks uses multiple widths to represent decimals
For the newly added Decimal(P > 38 & P <= 76, S), the LogicalType is Decimal256, which is represented by the custom int256, and its delegate LogicalType is INT_256.
Storage Layer
use int256 as storage #59808
Computing layer
Currently, StarRocks has abstracted a set of good computing layer expressions for Decimal,
DecimalV3Column
, which is well adapted to the precision and scale unique to decimal. For Decimal256, it can be reused directly.DecimalV3Column
is a fixed length column. We can reuse the serialized and deserialized implement. And we need to adapt the corresponding hash function for int256.Some core definitions as follow up:
Read-Written behavior
The read and write behavior is consistent with the previous decimal.
use
decimal(50, 48)
for exampleinsert into test_decimal(d1) select 1.222222;
work normalinsert into test_decimal(d1) select 11111111111111111111111111111111111111111111.222222;
Successfully written. Since the scale is 48, the integer part plus 48 has exceeded the maximum integer that can be represented by 256 bits, So fe directly casts the value to null.insert into test_decimal(d1) select 333
; throw an exception on the be sideERROR 1064 (HY000): Insert has filtered data
. Because the integer part plus the scale exceeds the maximum value represented by a 50-digit integer.Others behavior changes
Fixes #issue
#59645
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: