wud-if commented on code in PR #13412:
URL: https://github.com/apache/gluten/pull/13412#discussion_r4536360022
##########
gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/BaseRexCallConverters.java:
##########
@@ -89,6 +91,80 @@ public TypedExpr toTypedExpr(RexCall callNode,
RexConversionContext context) {
}
}
+/**
+ * Converter for the one-operand "-" RexCall (Flink's minusPrefix / SQL -x).
The name maps to the
+ * flinksql negate function; the result type equals the operand type, so no
cast is needed.
+ */
+class UnaryMinusRexCallConverter extends BaseRexCallConverter {
+ public UnaryMinusRexCallConverter(String functionName) {
+ super(functionName);
+ }
+
+ @Override
+ public ValidationResult isSuitable(RexCall callNode, RexConversionContext
context) {
+ if (callNode.getOperands().size() != 1) {
+ return ValidationResult.failure(
+ "Unary minus requires exactly one operand, but found: "
+ + getFunctionProtoTypeName(callNode));
+ }
+ // Numeric operand only: the interval form of unary minus would
+ // otherwise be accepted by the arity guard and fail later at
+ // toType (no interval type mapping); reject it at planning time.
+ // Decimals are accepted: velox's flinksql negate covers them.
+ try {
+ if (!org.apache.gluten.rexnode.TypeUtils.isNumericOrDecimalType(
Review Comment:
Thanks for the review! Done in 8534ae6 — TypeUtils and RexNodeConverter were
already imported at the top of the file; the fully qualified spellings in
UnaryMinusRexCallConverter are gone.
--
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]