pedrumj2 commented on code in PR #13604:
URL: https://github.com/apache/gluten/pull/13604#discussion_r4542224512


##########
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?
   
   @rui-mo good point, I added the original block back for the general case to 
be a fallback for all other operators
   
   ```
   case _ =>
             GenericExpressionTransformer(
               ExpressionMappings.expressionsMap(classOf[TryEval]),
               Seq(GenericExpressionTransformer(checkArithmeticExprName, 
Seq(left, right), original)),
               original)
   ```
   
   Please let me know if this works? 
   
   



-- 
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]

Reply via email to