yuanhang-dev commented on code in PR #9893:
URL: https://github.com/apache/incubator-gluten/pull/9893#discussion_r2157937246
##########
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:
> Should we add a ut test for this? as in my own testing, `select
to_timestamp('2024-01-01 12:12:12') - cast(134455611 as bigint)` is not
supported in valina flink.
Good point! This is indeed an important design consideration.
This is a temporary modification made to pass nexmark q0. This converter
supports timestamp and interval day-time operations. Vanilla Flink supports
INTERVAL syntax like `SELECT to_timestamp('2024-01-01 12:12:12') - INTERVAL
'134455611' SECOND;`
I will ensure behavioral consistency with vanilla Flink through unit tests
in https://github.com/apache/incubator-gluten/pull/9630.
--
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]