Skip to content

Conversation

@Xuanwo
Copy link
Member

@Xuanwo Xuanwo commented Oct 12, 2024

Close #663

This PR will implement Decimal from/to bytes represents.

@Xuanwo Xuanwo requested a review from liurenjie1024 October 12, 2024 12:46
Copy link
Contributor

@sdd sdd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The values in the tests match what I'd expect from converting manually 👍🏼

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Xuanwo for fixing this, generally LGTM! Left some minor points to fix.

chenzl25 added a commit to risingwavelabs/iceberg-rust that referenced this pull request Oct 30, 2024
ZENOTME pushed a commit to risingwavelabs/iceberg-rust that referenced this pull request Nov 19, 2024
ZENOTME pushed a commit to risingwavelabs/iceberg-rust that referenced this pull request Nov 29, 2024
@Xuanwo
Copy link
Member Author

Xuanwo commented Dec 6, 2024

cc @liurenjie1024 and @Fokko to take another look, sorry for the long wait.

@Xuanwo Xuanwo requested review from Fokko and liurenjie1024 December 8, 2024 06:55
Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Xuanwo for this great pr, left some minor suggestions!

if let Type::Primitive(p) = r#type {
Ok(Self {
r#type: p,
literal: PrimitiveLiteral::Int128(decimal.mantissa()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect, we need to validate that the precision is large enough to hold this value. For example, if the input decimal is 123456789, and the required precision is 4, then we should throw an error here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, and I added a new unit test to cover this case. PTAL, thank you!

@Xuanwo
Copy link
Member Author

Xuanwo commented Dec 13, 2024

cc @Fokko, would you like to take another look? I believe it's good for merging now.

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Xuanwo , LGTM!

@liurenjie1024 liurenjie1024 merged commit 03f0889 into apache:main Dec 13, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Allow reading data type Decimal

4 participants