zhli1142015 commented on code in PR #5985:
URL: https://github.com/apache/incubator-gluten/pull/5985#discussion_r1628696612
##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:
##########
@@ -123,42 +123,50 @@ class VeloxSparkPlanExecApi extends SparkPlanExecApi {
original)
}
- override def genTryAddTransformer(
+ override def genTryArithmeticTransformer(
substraitExprName: String,
left: ExpressionTransformer,
right: ExpressionTransformer,
- original: TryEval): ExpressionTransformer = {
+ original: TryEval,
+ checkArithmeticExprName: String): ExpressionTransformer = {
if (SparkShimLoader.getSparkShims.withAnsiEvalMode(original.child)) {
- throw new GlutenNotSupportException(s"add with ansi mode is not
supported")
+ throw new GlutenNotSupportException(
+ s"${original.child.prettyName} with ansi mode is not supported")
}
original.child.dataType match {
case LongType | IntegerType | ShortType | ByteType =>
- case _ => throw new GlutenNotSupportException(s"try_add is not
supported")
+ case _ => throw new GlutenNotSupportException(s"$substraitExprName is
not supported")
}
// Offload to velox for only IntegralTypes.
GenericExpressionTransformer(
substraitExprName,
- Seq(GenericExpressionTransformer(ExpressionNames.TRY_ADD, Seq(left,
right), original)),
+ Seq(GenericExpressionTransformer(checkArithmeticExprName, Seq(left,
right), original)),
original)
}
- override def genAddTransformer(
+ /**
+ * Map arithmetic expr to different functions: substraitExprName or
try(checkArithmeticExprName)
+ * based on EvalMode.
+ */
+ override def genArithmeticTransformer(
Review Comment:
Yes, All the try_xx expressions are `RuntimeReplaceable `, they are
converted to some other expressions, Before spark 3.4, they are converted to
`TryEval(XX(failOnError = true))`,
https://github.com/apache/spark/blob/branch-3.3/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TryEval.scala#L81,
`genTryArithmeticTransformer ` is added to handle this case.
After spark 3.4, for numeric types, they are converted to
`XX(EvalMode.TRY)`, `genArithmeticTransformer` is added to handle this case,
for velox we still convert it to `TryEval(XX(failOnError = true))`.
Both are converted to `try(check_xx)` in velox.
--
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]