rui-mo commented on code in PR #13604:
URL: https://github.com/apache/gluten/pull/13604#discussion_r4532261445
##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:
##########
@@ -141,8 +141,8 @@ class VeloxSparkPlanExecApi extends SparkPlanExecApi with
Logging {
}
/**
- * Map arithmetic expr to different functions: substraitExprName or
try(checkArithmeticExprName)
- * based on EvalMode.
+ * Map arithmetic expr to different functions based on EvalMode:
substraitExprName by default,
+ * checkArithmeticExprName in ANSI mode, and Velox's try_ function in TRY
mode.
Review Comment:
Could we add a TODO in `genArithmeticTransformer` noting that
`try(checkArithmeticExprName)` and the special arithmetic transformer handling
can be removed once Velox supports all relevant `try_*` functions?
##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:
##########
@@ -156,11 +156,16 @@ class VeloxSparkPlanExecApi extends SparkPlanExecApi with
Logging {
case _ =>
throw new GlutenNotSupportException(s"$substraitExprName with try
mode is not supported")
}
- // Offload to velox for only IntegralTypes.
- GenericExpressionTransformer(
- ExpressionMappings.expressionsMap(classOf[TryEval]),
- Seq(GenericExpressionTransformer(checkArithmeticExprName, Seq(left,
right), original)),
- original)
+ // Offload to velox for only IntegralTypes. The try_ functions return
NULL only when the
+ // operation overflows, so an error in an argument still throws, as in
Spark.
+ val tryExprName = original match {
+ case _: Add => ExpressionNames.TRY_ADD
+ case _: Subtract => ExpressionNames.TRY_SUBTRACT
+ case _: Multiply => ExpressionNames.TRY_MULTIPLY
+ case _ =>
+ throw new GlutenNotSupportException(s"$substraitExprName with try
mode is not supported")
Review Comment:
Could we still offload Divide to Velox with the previous approach:
`try(checked_divide)` instead of throwing, which would cause fallback to Spark?
--
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]