[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: URL: https://github.com/apache/calcite/pull/1057#discussion_r456784462 ## File path: core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java ## @@ -1070,4 +1070,13 @@ public IntHolder(int value) { + "from \"s\".\"primesCustomBoxed\"") .returnsUnordered("EXPR$0=false\nEXPR$0=false\nEXPR$0=true"); } + + @Test public void testUnaryMinus() { Review comment: OK 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: us...@infra.apache.org
[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_r269541808 ## File path: core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java ## @@ -625,6 +637,12 @@ private void check(ResultSetMetaData metaData, String columnName, private void checkOp(CalciteAssert.AssertThat with, String fn) { for (Field field : EveryType.numericFields()) { for (Field field2 : EveryType.numericFields()) { +//Decimal +-*/ others types has bug see CALCITE-2861 +//when CALCITE-2861 was solved, remove this code logic Review comment: OK 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: us...@infra.apache.org With regards, Apache Git Services
[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_r269527965 ## File path: core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java ## @@ -625,6 +637,12 @@ private void check(ResultSetMetaData metaData, String columnName, private void checkOp(CalciteAssert.AssertThat with, String fn) { for (Field field : EveryType.numericFields()) { for (Field field2 : EveryType.numericFields()) { +//Decimal +-*/ others types has bug see CALCITE-2861 Review comment: Thanks for your suggestion, i will make a change 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: us...@infra.apache.org With regards, Apache Git Services
[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_r269522882 ## File path: core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java ## @@ -953,13 +974,13 @@ public IntAndString(int id, String value) { false, (byte) 0, (char) 0, (short) 0, 0, 0L, 0F, 0D, false, (byte) 0, (char) 0, (short) 0, 0, 0L, 0F, 0D, new java.sql.Date(0), new Time(0), new Timestamp(0), -new Date(0), "1"), +new Date(0), "1", BigDecimal.valueOf(-1)), new EveryType( true, Byte.MAX_VALUE, Character.MAX_VALUE, Short.MAX_VALUE, Integer.MAX_VALUE, Long.MAX_VALUE, Float.MAX_VALUE, Double.MAX_VALUE, null, null, null, null, null, null, null, null, -null, null, null, null, null), +null, null, null, null, null, new BigDecimal("1.2")), Review comment: Yes, we should consider the null corner case 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: us...@infra.apache.org With regards, Apache Git Services
[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 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: us...@infra.apache.org With regards, Apache Git Services