Repository: calcite Updated Branches: refs/heads/master 6a22cc25f -> 80c04cb60
[CALCITE-2505] Add ignored test for fail in RexSimplify with IS DISTINCT FROM Simplification of isFalse(isNotDistinctFrom(vBool(0), vBool(1))) causes AssertionError: wrong operand count 1 for IS DISTINCT FROM Project: http://git-wip-us.apache.org/repos/asf/calcite/repo Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/80c04cb6 Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/80c04cb6 Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/80c04cb6 Branch: refs/heads/master Commit: 80c04cb6028f307a599350fda32411fc19733b3c Parents: 6a22cc2 Author: Vladimir Sitnikov <[email protected]> Authored: Wed Aug 29 23:49:46 2018 +0300 Committer: Vladimir Sitnikov <[email protected]> Committed: Wed Aug 29 23:50:05 2018 +0300 ---------------------------------------------------------------------- .../org/apache/calcite/test/RexProgramBuilderBase.java | 12 ++++++++++++ .../java/org/apache/calcite/test/RexProgramTest.java | 8 ++++++++ 2 files changed, 20 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/calcite/blob/80c04cb6/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 b018109..a5ec6ff 100644 --- a/core/src/test/java/org/apache/calcite/test/RexProgramBuilderBase.java +++ b/core/src/test/java/org/apache/calcite/test/RexProgramBuilderBase.java @@ -159,6 +159,10 @@ public abstract class RexProgramBuilderBase { return rexBuilder.makeCall(SqlStdOperatorTable.IS_NULL, node); } + protected RexNode isUnknown(RexNode node) { + return rexBuilder.makeCall(SqlStdOperatorTable.IS_UNKNOWN, node); + } + protected RexNode isNotNull(RexNode node) { return rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_NULL, node); } @@ -179,6 +183,14 @@ public abstract class RexProgramBuilderBase { return rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_TRUE, node); } + protected RexNode isDistinctFrom(RexNode a, RexNode b) { + return rexBuilder.makeCall(SqlStdOperatorTable.IS_DISTINCT_FROM, a, b); + } + + protected RexNode isNotDistinctFrom(RexNode a, RexNode b) { + return rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_DISTINCT_FROM, a, b); + } + protected RexNode nullIf(RexNode node1, RexNode node2) { return rexBuilder.makeCall(SqlStdOperatorTable.NULLIF, node1, node2); } http://git-wip-us.apache.org/repos/asf/calcite/blob/80c04cb6/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 7d0afee..7950f65 100644 --- a/core/src/test/java/org/apache/calcite/test/RexProgramTest.java +++ b/core/src/test/java/org/apache/calcite/test/RexProgramTest.java @@ -56,6 +56,7 @@ import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import java.math.BigDecimal; @@ -2058,6 +2059,13 @@ public class RexProgramTest extends RexProgramBuilderBase { assertThat(getString(map3), is("{1=?0.a, 2=?0.a}")); } + @Ignore("[CALCITE-2505] java.lang.AssertionError: wrong operand count 1 for IS DISTINCT FROM") + @Test public void notDistinct() { + checkSimplify2( + isFalse(isNotDistinctFrom(vBool(0), vBool(1))), + "...", "..."); + } + /** Converts a map to a string, sorting on the string representation of its * keys. */ private static String getString(ImmutableMap<RexNode, RexNode> map) {
