rui-mo commented on code in PR #5985:
URL: https://github.com/apache/incubator-gluten/pull/5985#discussion_r1627369020


##########
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:
   I wonder why we map Add to try_add. Is it to solve some semantic difference?



##########
cpp/velox/operators/functions/RegistrationAllFunctions.cc:
##########
@@ -67,6 +68,10 @@ void registerFunctionOverwrite() {
       kRowConstructorWithAllNull,
       
std::make_unique<RowConstructorWithNullCallToSpecialForm>(kRowConstructorWithAllNull));
   velox::functions::sparksql::registerBitwiseFunctions("spark_");
+  
velox::functions::registerBinaryIntegral<velox::functions::CheckedPlusFunction>({"try_add"});
+  
velox::functions::registerBinaryIntegral<velox::functions::CheckedMinusFunction>({"try_subtract"});
+  
velox::functions::registerBinaryIntegral<velox::functions::CheckedMultiplyFunction>({"try_multiply"});
+  
velox::functions::registerBinaryIntegral<velox::functions::CheckedDivideFunction>({"try_divide"});

Review Comment:
   I notice they are registered in Velox Presto functions. Can we also register 
them in Velox Spark functions?



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