We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Performing binary operations between decimal columns with high precisions causes a failure.
Steps/Code to reproduce bug For example:
import cudf from cudf.core.dtypes import Decimal64Dtype s1 = cudf.Series(["1.4", "3.4"]).astype(Decimal64Dtype(10,2)) s2 = cudf.Series(["8.6", "6.3"]).astype(Decimal64Dtype(12,4)) s1 * s2
returns
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-31-b2746bbf79b6> in <module> 4 s1 = cudf.Series(["1.4", "3.4"]).astype(Decimal64Dtype(10,2)) 5 s2 = cudf.Series(["8.6", "6.3"]).astype(Decimal64Dtype(12,4)) ----> 6 s1 * s2 /home/nfs/cjarrett/anaconda3/envs/rapids-gpu-bdb/lib/python3.8/site-packages/cudf/core/frame.py in __mul__(self, other) 3676 3677 def __mul__(self, other): -> 3678 return self._binaryop(other, "mul") 3679 3680 def __rmul__(self, other): /home/nfs/cjarrett/anaconda3/envs/rapids-gpu-bdb/lib/python3.8/site-packages/cudf/core/series.py in _binaryop(self, other, fn, fill_value, reflect, can_reindex) 1341 lhs = self 1342 -> 1343 return super()._binaryop(other, fn, fill_value, reflect, lhs) 1344 1345 def add(self, other, fill_value=None, axis=0): /home/nfs/cjarrett/anaconda3/envs/rapids-gpu-bdb/lib/python3.8/site-packages/cudf/core/frame.py in _binaryop(self, other, fn, fill_value, reflect, lhs, *args, **kwargs) 3603 rhs = rhs.fillna(fill_value) 3604 -> 3605 outcol = lhs._column.binary_operator(fn, rhs, reflect=reflect) 3606 3607 # Get the appropriate name for output operations involving two objects /home/nfs/cjarrett/anaconda3/envs/rapids-gpu-bdb/lib/python3.8/site-packages/cudf/core/column/decimal.py in binary_operator(self, op, other, reflect) 89 ) # precision will be ignored, libcudf has no notion of precision 90 result = libcudf.binaryop.binaryop(self, other, op, output_type) ---> 91 result.dtype.precision = _binop_precision( 92 self.dtype, other.dtype, op 93 ) /home/nfs/cjarrett/anaconda3/envs/rapids-gpu-bdb/lib/python3.8/site-packages/cudf/core/dtypes.py in precision(self, value) 279 @precision.setter 280 def precision(self, value): --> 281 self._validate(value, self.scale) 282 self._typ = pa.decimal128(precision=value, scale=self.scale) 283 /home/nfs/cjarrett/anaconda3/envs/rapids-gpu-bdb/lib/python3.8/site-packages/cudf/core/dtypes.py in _validate(cls, precision, scale) 314 def _validate(cls, precision, scale=0): 315 if precision > Decimal64Dtype.MAX_PRECISION: --> 316 raise ValueError( 317 f"Cannot construct a {cls.__name__}" 318 f" with precision > {cls.MAX_PRECISION}" ValueError: Cannot construct a Decimal64Dtype with precision > 18.0
The text was updated successfully, but these errors were encountered:
Clip decimal binary op precision at max precision (#8194)
7231e3b
This fixes an issue where the precision assigned to the result of a decimal binary operation may exceed the maximum precision. Closes #8291 Authors: - https://github.com/ChrisJar Approvers: - Michael Wang (https://github.com/isVoid) - Christopher Harris (https://github.com/cwharris) - Nghia Truong (https://github.com/ttnghia) URL: #8194
Successfully merging a pull request may close this issue.
Describe the bug
Performing binary operations between decimal columns with high precisions causes a failure.
Steps/Code to reproduce bug
For example:
returns
The text was updated successfully, but these errors were encountered: