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

[REVIEW] Enable typecasting between decimal and int #7691

Merged
merged 3 commits into from
Mar 30, 2021

Conversation

ChrisJar
Copy link
Contributor

@ChrisJar ChrisJar commented Mar 23, 2021

This enables type conversions between decimal types and int types.

Closes #7440

@github-actions github-actions bot added the Python Affects Python cuDF API. label Mar 23, 2021
@ChrisJar ChrisJar changed the title Implement casting between decimal and int64 Implement typecasting between decimal and int64 Mar 23, 2021
@codecov
Copy link

codecov bot commented Mar 23, 2021

Codecov Report

Merging #7691 (b0cb63e) into branch-0.19 (7871e7a) will increase coverage by 0.65%.
The diff coverage is n/a.

❗ Current head b0cb63e differs from pull request most recent head cb14408. Consider uploading reports for the commit cb14408 to get more accurate results
Impacted file tree graph

@@               Coverage Diff               @@
##           branch-0.19    #7691      +/-   ##
===============================================
+ Coverage        81.86%   82.52%   +0.65%     
===============================================
  Files              101      101              
  Lines            16884    17447     +563     
===============================================
+ Hits             13822    14398     +576     
+ Misses            3062     3049      -13     
Impacted Files Coverage Δ
python/cudf/cudf/utils/gpu_utils.py 53.65% <0.00%> (-4.88%) ⬇️
python/cudf/cudf/core/column/lists.py 87.68% <0.00%> (-3.72%) ⬇️
python/cudf/cudf/core/abc.py 87.23% <0.00%> (-1.14%) ⬇️
python/cudf/cudf/core/column/decimal.py 93.84% <0.00%> (-1.03%) ⬇️
python/cudf/cudf/core/column/column.py 87.61% <0.00%> (-0.15%) ⬇️
python/cudf/cudf/utils/utils.py 85.36% <0.00%> (-0.07%) ⬇️
python/cudf/cudf/io/feather.py 100.00% <0.00%> (ø)
python/cudf/cudf/utils/ioutils.py 78.71% <0.00%> (ø)
python/cudf/cudf/comm/serialize.py 0.00% <0.00%> (ø)
python/cudf/cudf/_fuzz_testing/io.py 0.00% <0.00%> (ø)
... and 45 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe7ec85...cb14408. Read the comment docs.

@ChrisJar ChrisJar changed the title Implement typecasting between decimal and int64 [WIP] Implement typecasting between decimal and int64 Mar 24, 2021
@ttnghia
Copy link
Contributor

ttnghia commented Mar 26, 2021

This is a workaround, not a fix. I would recommend figuring out what's wrong with the libcudf.unary.cast implementation instead.

@galipremsagar
Copy link
Contributor

@ChrisJar Now that #7733 is merged, we can enable type-casting decimal types to and from integer types as part of this PR itself.

@ChrisJar ChrisJar changed the title [WIP] Implement typecasting between decimal and int64 [WIP] Implement typecasting between decimal and int Mar 29, 2021
@ChrisJar ChrisJar marked this pull request as ready for review March 29, 2021 15:51
@ChrisJar ChrisJar requested a review from a team as a code owner March 29, 2021 15:51
@ChrisJar ChrisJar changed the title [WIP] Implement typecasting between decimal and int [REVIEW] Implement typecasting between decimal and int Mar 29, 2021
@ChrisJar ChrisJar changed the title [REVIEW] Implement typecasting between decimal and int [REVIEW] Enable typecasting between decimal and int Mar 29, 2021
@galipremsagar galipremsagar added bug Something isn't working non-breaking Non-breaking change feature request New feature or request and removed bug Something isn't working labels Mar 29, 2021
Comment on lines -83 to +82
result = libcudf.unary.cast(self, dtype)
if isinstance(dtype, cudf.core.dtypes.Decimal64Dtype):
result.dtype.precision = dtype.precision
return result
return libcudf.unary.cast(self, dtype)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a quick side note that this is needed in #7716

@galipremsagar galipremsagar added the 5 - Ready to Merge Testing and reviews complete, ready to merge label Mar 30, 2021
@galipremsagar
Copy link
Contributor

@gpucibot merge

@rapids-bot rapids-bot bot merged commit fdcdb96 into rapidsai:branch-0.19 Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge feature request New feature or request non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA] Support casting to DecimalDtypes in cuDF
4 participants