ulysses-you commented on code in PR #5654:
URL: https://github.com/apache/incubator-gluten/pull/5654#discussion_r1597946040
##########
gluten-core/src/main/scala/org/apache/gluten/utils/DecimalArithmeticUtil.scala:
##########
@@ -18,69 +18,40 @@ package org.apache.gluten.utils
import org.apache.gluten.backendsapi.BackendsApiManager
import org.apache.gluten.exception.GlutenNotSupportException
-import org.apache.gluten.expression.{CheckOverflowTransformer,
ChildTransformer, DecimalArithmeticExpressionTransformer, ExpressionTransformer}
import org.apache.gluten.expression.ExpressionConverter.conf
import org.apache.spark.sql.catalyst.analysis.DecimalPrecision
import org.apache.spark.sql.catalyst.expressions.{Add, BinaryArithmetic, Cast,
Divide, Expression, Literal, Multiply, Pmod, PromotePrecision, Remainder,
Subtract}
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types.{ByteType, Decimal, DecimalType,
IntegerType, LongType, ShortType}
-
-import scala.annotation.tailrec
+import org.apache.spark.sql.utils.DecimalTypeUtil
object DecimalArithmeticUtil {
- object OperationType extends Enumeration {
- type Config = Value
- val ADD, SUBTRACT, MULTIPLY, DIVIDE, MOD = Value
- }
-
- private val MIN_ADJUSTED_SCALE = 6
- val MAX_PRECISION = 38
-
// Returns the result decimal type of a decimal arithmetic computing.
- def getResultTypeForOperation(
- operationType: OperationType.Config,
- type1: DecimalType,
- type2: DecimalType): DecimalType = {
+ def getResultType(expr: BinaryArithmetic, type1: DecimalType, type2:
DecimalType): DecimalType = {
Review Comment:
If we are going into here, that means there is no checkoverflow for decimal
binary arithmetic. It should only happen after Spark 3.4. Should the result
decimal type always be `b.dataType` ?
--
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]