-
Notifications
You must be signed in to change notification settings - Fork 891
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
[REVIEW] Support building decimal columns with Table.TestBuilder [skip ci] #6770
Conversation
Please update the changelog in order to start CI tests. View the gpuCI docs here. |
Codecov Report
@@ Coverage Diff @@
## branch-0.17 #6770 +/- ##
===============================================
+ Coverage 81.73% 81.77% +0.04%
===============================================
Files 96 96
Lines 15981 15885 -96
===============================================
- Hits 13062 12990 -72
+ Misses 2919 2895 -24
Continue to review full report at Codecov.
|
I went through this PR and it looks good to me. It would be great if we could get it reviewed from @revans2 as he had reviewed and had comments on this part ( |
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.
Looks really good. Thanks for doing this.
int scale = type.getScale(); | ||
if (dataArray instanceof Integer[]) { | ||
BigDecimal[] data = Arrays.stream(((Integer[]) dataArray)) | ||
.map((i) -> i == null ? null : BigDecimal.valueOf(i, -scale)) |
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.
With unscaled values provided, why use BigDecimal
instead of using the much cheaper unscaled value decimal constructors?
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.
Because unscaled value constructors can not support null values, since it is for primitive values.
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.
unscaled value constructors can not support null values
That seems like a problem with the value constructors that needs a followup. We support value constructors for Integer values that can accept null values, so why can't we do the same for unscaled decimal values? Having to go through BigDecimal
to workaround a lack of functionality in the value constructor for decimals is not ideal.
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.
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.
Assuming an issue is filed to followup the lack of boxed unscaled decimal value construction, this looks OK to me.
This PR is about to support building decimal columns with Table.TestBuilder, which is widely used in automatic tests of spark-rapids plugin.