maropu commented on a change in pull request #25136: [SPARK-28322][SQL] Add
support to Decimal type for integral divide
URL: https://github.com/apache/spark/pull/25136#discussion_r315017065
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala
##########
@@ -400,6 +400,10 @@ final class Decimal extends Ordered[Decimal] with
Serializable {
if (that.isZero) null
else Decimal(toJavaBigDecimal.remainder(that.toJavaBigDecimal,
MATH_CONTEXT))
+ def quot(that: Decimal): Decimal =
+ if (that.isZero) null else Decimal(
+ toJavaBigDecimal.divideToIntegralValue(that.toJavaBigDecimal,
MATH_CONTEXT))
+
Review comment:
nit: Is the format along with `%`?
```
if (that.isZero) null
else
Decimal(toJavaBigDecimal.divideToIntegralValue(that.toJavaBigDecimal,
MATH_CONTEXT))
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]