zhztheplayer commented on a change in pull request #1057: [CALCITE-2854] code
gen error for UNARY_MINUS operator call with deci…
URL: https://github.com/apache/calcite/pull/1057#discussion_r261213393
##########
File path:
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
##########
@@ -2168,7 +2167,14 @@ public Expression implement(
RexCall call,
List<Expression> translatedOperands) {
final Expression operand = translatedOperands.get(0);
- final UnaryExpression e = Expressions.makeUnary(expressionType, operand);
+
+ final Expression e;
+ if (expressionType == ExpressionType.Negate && operand.type ==
BigDecimal.class) {
+ e = Expressions.call(BuiltInMethod.UNARY_MINUS.method, operand);
Review comment:
Have you taken a look at the "backup method" convention of the
`BinaryImplementor`? Is that also suitable here?
https://github.com/apache/calcite/blob/280642a02a4bcfd1fb9cbe8c5ab672d3619860e7/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java#L2090
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services