KevinyhZou commented on code in PR #9893:
URL: https://github.com/apache/incubator-gluten/pull/9893#discussion_r2157915513


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



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