PHILO-HE commented on code in PR #9893:
URL: https://github.com/apache/incubator-gluten/pull/9893#discussion_r2154137550
##########
gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/BaseRexCallConverters.java:
##########
@@ -84,3 +86,30 @@ public TypedExpr toTypedExpr(RexCall callNode,
RexConversionContext context) {
return new CallTypedExpr(resultType, alignedParams, functionName);
}
}
+
+class SubtractRexCallConverter extends BaseRexCallConverter {
+
+ public SubtractRexCallConverter() {
+ super("subtract");
+ }
+
+ @Override
+ public TypedExpr toTypedExpr(RexCall callNode, RexConversionContext context)
{
+ List<TypedExpr> params = getParams(callNode, context);
+
+ if (params.size() == 2
+ && params.get(0).getReturnType() instanceof TimestampType
+ && params.get(1).getReturnType() instanceof BigIntType) {
+
+ Type bigIntType = new BigIntType();
+ TypedExpr castedParam0 = new CallTypedExpr(bigIntType,
List.of(params.get(0)), "cast");
+
+ List<TypedExpr> newParams = List.of(castedParam0, params.get(1));
+ return new CallTypedExpr(bigIntType, newParams, functionName);
Review Comment:
For spark, the expression's result type is generally as same as left input's
type. Not sure Flink's behavior. Such handling with cast added may also be
extended for other binary arithmetic expressions whose left type is not as same
as right type.
We may first use this case-by-case handling.
--
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]