fe2s commented on code in PR #39099:
URL: https://github.com/apache/spark/pull/39099#discussion_r1057810986
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala:
##########
@@ -374,7 +374,7 @@ final class Decimal extends Ordered[Decimal] with
Serializable {
if (scale < _scale) {
// Easier case: we just need to divide our scale down
val diff = _scale - scale
- val pow10diff = POW_10(diff)
+ val pow10diff = POW_10(math.min(diff, MAX_LONG_DIGITS))
Review Comment:
Compact long can still be used when `diff > MAX_LONG_DIGITS`. In this case
`longVal` becomes `0`, `1` or `-1` depending on rounding, so using `BigDecimal`
is not actually needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]