You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by vl...@apache.org on 2018/08/29 21:17:47 UTC

calcite git commit: [CALCITE-2506] Add ignored test for fail in RexSimplify with coalesce

Repository: calcite
Updated Branches:
  refs/heads/master 80c04cb60 -> 1c30edca1


[CALCITE-2506] Add ignored test for fail in RexSimplify with coalesce

coalesce(unaryPlus(nullInt), unaryPlus(vInt())) fails with
result mismatch: when applied to {?0.int0=-1}, COALESCE(+(null), +(?0.int0)) yielded -1, and +(null) yielded NULL


Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/1c30edca
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/1c30edca
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/1c30edca

Branch: refs/heads/master
Commit: 1c30edca1bd7b60e3e8c0368a4c736c4775125d4
Parents: 80c04cb
Author: Vladimir Sitnikov <si...@gmail.com>
Authored: Thu Aug 30 00:16:03 2018 +0300
Committer: Vladimir Sitnikov <si...@gmail.com>
Committed: Thu Aug 30 00:17:18 2018 +0300

----------------------------------------------------------------------
 .../org/apache/calcite/test/RexProgramBuilderBase.java    |  8 ++++++++
 .../test/java/org/apache/calcite/test/RexProgramTest.java | 10 ++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/1c30edca/core/src/test/java/org/apache/calcite/test/RexProgramBuilderBase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/RexProgramBuilderBase.java b/core/src/test/java/org/apache/calcite/test/RexProgramBuilderBase.java
index a5ec6ff..e3c651f 100644
--- a/core/src/test/java/org/apache/calcite/test/RexProgramBuilderBase.java
+++ b/core/src/test/java/org/apache/calcite/test/RexProgramBuilderBase.java
@@ -199,6 +199,14 @@ public abstract class RexProgramBuilderBase {
     return rexBuilder.makeCall(SqlStdOperatorTable.NOT, node);
   }
 
+  protected RexNode unaryMinus(RexNode node) {
+    return rexBuilder.makeCall(SqlStdOperatorTable.UNARY_MINUS, node);
+  }
+
+  protected RexNode unaryPlus(RexNode node) {
+    return rexBuilder.makeCall(SqlStdOperatorTable.UNARY_PLUS, node);
+  }
+
   protected RexNode and(RexNode... nodes) {
     return and(ImmutableList.copyOf(nodes));
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/1c30edca/core/src/test/java/org/apache/calcite/test/RexProgramTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/RexProgramTest.java b/core/src/test/java/org/apache/calcite/test/RexProgramTest.java
index 7950f65..186594b 100644
--- a/core/src/test/java/org/apache/calcite/test/RexProgramTest.java
+++ b/core/src/test/java/org/apache/calcite/test/RexProgramTest.java
@@ -2066,6 +2066,16 @@ public class RexProgramTest extends RexProgramBuilderBase {
         "...", "...");
   }
 
+  @Ignore("[CALCITE-2505] java.lang.AssertionError: result mismatch")
+  @Test public void coalescePlusNull() {
+    // when applied to {?0.int0=-1},
+    // COALESCE(+(null), +(?0.int0)) yielded -1,
+    // and +(null) yielded NULL
+    checkSimplify2(
+        coalesce(unaryPlus(nullInt), unaryPlus(vInt())),
+        "...", "...");
+  }
+
   /** Converts a map to a string, sorting on the string representation of its
    * keys. */
   private static String getString(ImmutableMap<RexNode, RexNode> map) {