-
Notifications
You must be signed in to change notification settings - Fork 10
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
GH-120: Add initial Decimal32/Decimal64 implementation #121
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
We need integration test CI for this, right?
I'll prepare it.
Yea, the corresponding C++ PR for decimal 32/64 has the change to datagen.py to add these cases to the integration tests, and then when we update the CI integration tests to use this repo instead of the main arrow repo, we can unskip Go. |
} | ||
|
||
func NewDecimalType(id Type, prec, scale int32) (DecimalType, error) { | ||
switch id { | ||
case DECIMAL32: | ||
debug.Assert(prec <= int32(decimal.MaxPrecision[decimal.Decimal32]()), "invalid precision for decimal32") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this condition be an error? or is the DecimalNType
informational
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assumption being made is that if a user is explicitly calling NewDecimalType
they know what they are doing, so we only perform the precision validation in debug mode for performance.
Fix GH-120
Rationale for this change
Widening the Decimal128/256 type to allow for bitwidths of 32 and 64 allows for more interoperability with other libraries and utilities which already support these types. This provides even more opportunities for zero-copy interactions between things such as libcudf and various databases.
What changes are included in this PR?
This PR contains the basic Go implementations for Decimal32/Decimal64 types, arrays, builders and scalars. It also includes the minimum necessary to get everything compiling and tests passing without also extending the acero kernels and parquet handling (both of which will be handled in follow-up PRs).
Are these changes tested?
Yes, tests were extended where applicable to add decimal32/decimal64 cases.