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 2014/12/23 11:45:42 UTC
incubator-calcite git commit: [CALCITE-547] Set nullability while
inferring return type of item(any, ...) operator
Repository: incubator-calcite
Updated Branches:
refs/heads/master 4e95a8ca3 -> 8cdc66342
[CALCITE-547] Set nullability while inferring return type of item(any,...) operator
Close apache/incubator-calcite#37
Project: http://git-wip-us.apache.org/repos/asf/incubator-calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/8cdc6634
Tree: http://git-wip-us.apache.org/repos/asf/incubator-calcite/tree/8cdc6634
Diff: http://git-wip-us.apache.org/repos/asf/incubator-calcite/diff/8cdc6634
Branch: refs/heads/master
Commit: 8cdc6634267e138e237bba785e46ea0017c2a0fd
Parents: 4e95a8c
Author: Mehant Baid <me...@gmail.com>
Authored: Mon Dec 22 09:24:59 2014 -0800
Committer: Vladimir Sitnikov <si...@gmail.com>
Committed: Tue Dec 23 13:03:27 2014 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/calcite/sql/fun/SqlItemOperator.java | 3 ++-
.../java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/8cdc6634/core/src/main/java/org/apache/calcite/sql/fun/SqlItemOperator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/fun/SqlItemOperator.java b/core/src/main/java/org/apache/calcite/sql/fun/SqlItemOperator.java
index fb4d127..aafa153 100644
--- a/core/src/main/java/org/apache/calcite/sql/fun/SqlItemOperator.java
+++ b/core/src/main/java/org/apache/calcite/sql/fun/SqlItemOperator.java
@@ -128,7 +128,8 @@ class SqlItemOperator extends SqlSpecialOperator {
return typeFactory.createTypeWithNullability(operandType.getValueType(),
true);
case ANY:
- return typeFactory.createSqlType(SqlTypeName.ANY);
+ return typeFactory.createTypeWithNullability(
+ typeFactory.createSqlType(SqlTypeName.ANY), true);
default:
throw new AssertionError();
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/8cdc6634/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java b/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
index 6e160c7..ecacb2d 100644
--- a/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
+++ b/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
@@ -4296,6 +4296,9 @@ public abstract class SqlOperatorBaseTest {
"map['foo', CAST(NULL AS INTEGER), 'bar', 7]['baz']",
"INTEGER",
null);
+ tester.checkColumnType(
+ "select cast(null as any)['x'] from (values(1))",
+ "ANY");
}
@Test public void testMapValueConstructor() {