You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2017/12/06 07:35:45 UTC
[2/5] calcite git commit: [CALCITE-2069]
RexSimplify.removeNullabilityCast() always removes cast for operand with ANY
type (Volodymyr Vysotskyi)
[CALCITE-2069] RexSimplify.removeNullabilityCast() always removes cast for operand with ANY type (Volodymyr Vysotskyi)
Close apache/calcite#574
Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/189aad19
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/189aad19
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/189aad19
Branch: refs/heads/master
Commit: 189aad19c4f904e4dd0602fb64c65c5586f093b2
Parents: 11da17b
Author: Volodymyr Vysotskyi <vv...@gmail.com>
Authored: Tue Nov 28 17:42:25 2017 +0200
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Dec 1 16:27:51 2017 -0800
----------------------------------------------------------------------
.../org/apache/calcite/sql/type/SqlTypeUtil.java | 4 ----
.../org/apache/calcite/test/RelBuilderTest.java | 19 ++++++++++++++++++-
2 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite/blob/189aad19/core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java
index 4c27f8a..9113dd8 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java
@@ -1110,10 +1110,6 @@ public abstract class SqlTypeUtil {
return true;
}
- if (isAny(type1) || isAny(type2)) {
- return true;
- }
-
if (type1.isNullable() == type2.isNullable()) {
// If types have the same nullability and they weren't equal above,
// they must be different.
http://git-wip-us.apache.org/repos/asf/calcite/blob/189aad19/core/src/test/java/org/apache/calcite/test/RelBuilderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/RelBuilderTest.java b/core/src/test/java/org/apache/calcite/test/RelBuilderTest.java
index 4858841..115f9ff 100644
--- a/core/src/test/java/org/apache/calcite/test/RelBuilderTest.java
+++ b/core/src/test/java/org/apache/calcite/test/RelBuilderTest.java
@@ -1865,7 +1865,7 @@ public class RelBuilderTest {
* <a href="https://issues.apache.org/jira/browse/CALCITE-1595">[CALCITE-1595]
* RelBuilder.call throws NullPointerException if argument types are
* invalid</a>. */
- @Test public void testTypeInferenceValidation() throws Exception {
+ @Test public void testTypeInferenceValidation() {
final RelBuilder builder = RelBuilder.create(config().build());
// test for a) call(operator, Iterable<RexNode>)
final RexNode arg0 = builder.literal(0);
@@ -1971,6 +1971,23 @@ public class RelBuilderTest {
+ " LogicalTableScan(table=[[scott, EMP]])\n";
assertThat(str(root), is(expected));
}
+
+ @Test public void testFilterCastAny() {
+ final RelBuilder builder = RelBuilder.create(config().build());
+ final RelDataType anyType =
+ builder.getTypeFactory().createSqlType(SqlTypeName.ANY);
+ final RelNode root =
+ builder.scan("EMP")
+ .filter(
+ builder.cast(
+ builder.getRexBuilder().makeInputRef(anyType, 0),
+ SqlTypeName.BOOLEAN))
+ .build();
+ final String expected = ""
+ + "LogicalFilter(condition=[CAST($0):BOOLEAN NOT NULL])\n"
+ + " LogicalTableScan(table=[[scott, EMP]])\n";
+ assertThat(str(root), is(expected));
+ }
}
// End RelBuilderTest.java