cloud-fan commented on code in PR #36698:
URL: https://github.com/apache/spark/pull/36698#discussion_r886758935
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala:
##########
@@ -778,16 +1002,24 @@ case class Pmod(
val javaType = CodeGenerator.javaType(dataType)
lazy val errorContext = ctx.addReferenceObj("errCtx", queryContext)
val result = dataType match {
- case DecimalType.Fixed(_, _) =>
+ case DecimalType.Fixed(precision, scale) =>
+ val errorContextCode = if (nullOnOverflow) {
+ "\"\""
+ } else {
+ errorContext
+ }
val decimalAdd = "$plus"
s"""
- $javaType $remainder = ${eval1.value}.remainder(${eval2.value});
- if ($remainder.compare(new
org.apache.spark.sql.types.Decimal().set(0)) < 0) {
-
${ev.value}=($remainder.$decimalAdd(${eval2.value})).remainder(${eval2.value});
- } else {
- ${ev.value}=$remainder;
- }
- """
+ |$javaType $remainder = ${eval1.value}.remainder(${eval2.value});
Review Comment:
With this change, `def decimalMethod` is not useless anymore in this class.
--
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]