Skip to content
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

fix: parse var len of decimal for parquet statistic #837

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ZENOTME
Copy link
Contributor

@ZENOTME ZENOTME commented Dec 24, 2024

I find that the decimal encode for parquet statistic will be byte with var len. Not necessary with 16 len. So we need to extend it when the len smaller than 16.

@ZENOTME
Copy link
Contributor Author

ZENOTME commented Dec 24, 2024

cc @Xuanwo @liurenjie1024

precision: 38,
scale: 0
},
PrimitiveLiteral::Int128(99999999999999999999999999999999999999_i128)
Copy link
Member

Choose a reason for hiding this comment

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

Hi, I assume the limitation of rust_decimal is that it only supports up to 28 digits of precision. Values of Decimal larger than Decimal::MAX or smaller than Decimal::MIN are not supported.

The best we can do here is raising an error if users trying to read or write Decimal larger than 28.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But from the definition of iceberg spec, the precision of decimal can be 38. So I think for here we can't prevent user write decimal with precision larger than 28 but smaller than 38. https://iceberg.apache.org/spec/#primitive-types

Copy link
Member

Choose a reason for hiding this comment

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

Yep, that is exactly the issue I raised here #669

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, according to my understanding, our decimal is not restricted by rust_decimal.🤔 Internally iceberg have its own decimal representation.

For here, we just provide a way let the user pass a rust_decimal and convert it into our decimal representation. If the rust_decimal is that it only supports up to 28 digits of precision, when user want to more precision, they can pass other format to convert it into our decimal representation. Or as #669, we can provide a way to convert other decimal which support more precision to our decimal representation.

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.

2 participants