You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/03/27 11:44:17 UTC

[GitHub] [calcite] yuqi1129 commented on a change in pull request #1057: [CALCITE-2854] code gen error for UNARY_MINUS operator call with deci…

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

 ##########
 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:
   BinaryImplementor ? As far as i known, it only be used in binary operator and problem is unary minus. If I understand it incorrectly, please correct me. thanks
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services