Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
galipremsagar committed Feb 16, 2022
1 parent c12f9f7 commit 71572ec
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions python/cudf/cudf/core/column/decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,22 +391,18 @@ def _get_decimal_type(lhs_dtype, rhs_dtype, op):
# MAX_PRECISION of `lhs_dtype` & `rhs_dtype` so that we can only check
# and return a dtype that is greater than or equal to input dtype that
# can fit `precision` & `scale`.
max_precision = max(
lhs_dtype.MAX_PRECISION, rhs_dtype.MAX_PRECISION
)
max_precision = max(lhs_dtype.MAX_PRECISION, rhs_dtype.MAX_PRECISION)
for decimal_type in (
cudf.Decimal32Dtype,
cudf.Decimal64Dtype,
cudf.Decimal128Dtype,
):
if decimal_type.MAX_PRECISION >= lhs_rhs_max_precision:
if decimal_type.MAX_PRECISION >= max_precision:
try:
return decimal_type(precision=precision, scale=scale)
except ValueError:
# Call to _validate fails, which means we need
# to try the next dtype
pass
else:
return min_decimal_type

raise OverflowError("Maximum supported decimal type is Decimal128")

0 comments on commit 71572ec

Please sign in to comment.