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

[BUG]Decimal128 OverflowError BUG? #11337

Closed
pengyizeng opened this issue Jul 24, 2022 · 3 comments · Fixed by #12063
Closed

[BUG]Decimal128 OverflowError BUG? #11337

pengyizeng opened this issue Jul 24, 2022 · 3 comments · Fixed by #12063
Assignees
Labels
bug Something isn't working Python Affects Python cuDF API.

Comments

@pengyizeng
Copy link

pengyizeng commented Jul 24, 2022

BUG EXAMPlE:

>>> a = Decimal('0.0009384233522166997927180531650178250')
>>> b =cudf.Series([a])
>>> b
0    0.0009384233522166997927180531650178250
dtype: decimal128
>>> b*b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/zen/anaconda3/envs/rapids-22.06/lib/python3.9/site-packages/cudf/core/mixins/mixin_factory.py", line 11, in wrapper
    return method(self, *args1, *args2, **kwargs1, **kwargs2)
  File "/home/zen/anaconda3/envs/rapids-22.06/lib/python3.9/site-packages/cudf/core/indexed_frame.py", line 2188, in _binaryop
    ColumnAccessor(type(self)._colwise_binop(operands, op)),
  File "/home/zen/anaconda3/envs/rapids-22.06/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/zen/anaconda3/envs/rapids-22.06/lib/python3.9/site-packages/cudf/core/frame.py", line 2436, in _colwise_binop
    else getattr(operator, fn)(left_column, right_column)
  File "/home/zen/anaconda3/envs/rapids-22.06/lib/python3.9/site-packages/cudf/core/mixins/mixin_factory.py", line 11, in wrapper
    return method(self, *args1, *args2, **kwargs1, **kwargs2)
  File "/home/zen/anaconda3/envs/rapids-22.06/lib/python3.9/site-packages/cudf/core/column/decimal.py", line 84, in _binaryop
    output_type = _get_decimal_type(self.dtype, other.dtype, op)
  File "/home/zen/anaconda3/envs/rapids-22.06/lib/python3.9/site-packages/cudf/core/column/decimal.py", line 402, in _get_decimal_type
    raise OverflowError("Maximum supported decimal type is Decimal128")
OverflowError: Maximum supported decimal type is Decimal128

Is there any solution to avoid the OverflowError when doing math operations like this above?

@pengyizeng pengyizeng added Needs Triage Need team to review and classify bug Something isn't working labels Jul 24, 2022
@shwina
Copy link
Contributor

shwina commented Jul 25, 2022

It looks like the result type is too large to fit in Decimal128. Would silently overflowing in this situation would be preferable over raising an OverflowError? For all other data types, we (and Pandas) do silently overflow.

@pengyizeng
Copy link
Author

I think silently overflowing in Decimal128 type will be preferable over raising an Error. Hope to make the improvement in the Decimal128 type.

@shwina shwina added Python Affects Python cuDF API. and removed Needs Triage Need team to review and classify labels Jul 25, 2022
@galipremsagar galipremsagar self-assigned this Jul 25, 2022
@github-actions
Copy link

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

@pengyizeng pengyizeng reopened this Oct 4, 2022
rapids-bot bot pushed a commit that referenced this issue Nov 4, 2022
Fixes: #11337 

- [x] This PR removes raising of an overflow error and rather let's the data overflow similar to what we do with other numeric dtypes.

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Bradley Dice (https://github.com/bdice)

URL: #12063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants