zhli1142015 commented on code in PR #5985:
URL: https://github.com/apache/incubator-gluten/pull/5985#discussion_r1627410680
##########
gluten-core/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:
##########
@@ -563,18 +563,68 @@ object ExpressionConverter extends SQLConfHelper with
Logging {
arrayTransform
)
case tryEval @ TryEval(a: Add) =>
- BackendsApiManager.getSparkPlanExecApiInstance.genTryAddTransformer(
+
BackendsApiManager.getSparkPlanExecApiInstance.genTryArithmeticTransformer(
substraitExprName,
replaceWithExpressionTransformerInternal(a.left, attributeSeq,
expressionsMap),
replaceWithExpressionTransformerInternal(a.right, attributeSeq,
expressionsMap),
- tryEval
+ tryEval,
+ ExpressionNames.TRY_ADD
+ )
+ case tryEval @ TryEval(a: Subtract) =>
+
BackendsApiManager.getSparkPlanExecApiInstance.genTryArithmeticTransformer(
+ substraitExprName,
+ replaceWithExpressionTransformerInternal(a.left, attributeSeq,
expressionsMap),
+ replaceWithExpressionTransformerInternal(a.right, attributeSeq,
expressionsMap),
+ tryEval,
+ ExpressionNames.TRY_SUBTRACT
+ )
+ case tryEval @ TryEval(a: Divide) =>
+
BackendsApiManager.getSparkPlanExecApiInstance.genTryArithmeticTransformer(
+ substraitExprName,
+ replaceWithExpressionTransformerInternal(a.left, attributeSeq,
expressionsMap),
+ replaceWithExpressionTransformerInternal(a.right, attributeSeq,
expressionsMap),
+ tryEval,
+ ExpressionNames.TRY_DIVIDE
+ )
+ case tryEval @ TryEval(a: Multiply) =>
+
BackendsApiManager.getSparkPlanExecApiInstance.genTryArithmeticTransformer(
+ substraitExprName,
+ replaceWithExpressionTransformerInternal(a.left, attributeSeq,
expressionsMap),
+ replaceWithExpressionTransformerInternal(a.right, attributeSeq,
expressionsMap),
+ tryEval,
+ ExpressionNames.TRY_MULTIPLY
)
case a: Add =>
- BackendsApiManager.getSparkPlanExecApiInstance.genAddTransformer(
+
BackendsApiManager.getSparkPlanExecApiInstance.genArithmeticTransformer(
substraitExprName,
replaceWithExpressionTransformerInternal(a.left, attributeSeq,
expressionsMap),
replaceWithExpressionTransformerInternal(a.right, attributeSeq,
expressionsMap),
- a
+ a,
+ ExpressionNames.TRY_ADD
Review Comment:
After spark 3.4 `try_add` is converted to to `add(EvalMode.TRY)`, here may
generate wrong results as we don't map it to correct velox functions.
`genArithmeticTransformer` would map add to correct functions based on the
`EvalMode`.
Thanks.
https://github.com/apache/incubator-gluten/pull/5356#issue-2234987326
https://github.com/apache/spark/blob/c4f720dfb41919dade7002b49462b3ff6b91eb22/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TryEval.scala#L82C6-L82C78
--
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]