Ran Tao created CALCITE-6040:
--------------------------------
Summary: SqlOperatorFixture check result type failed for converted
types
Key: CALCITE-6040
URL: https://issues.apache.org/jira/browse/CALCITE-6040
Project: Calcite
Issue Type: Bug
Components: tests
Affects Versions: 1.35.0
Reporter: Ran Tao
we have a simple test case:
{code:java}
f.checkScalar("map[1, null]", "{1=null}",
"(INTEGER NOT NULL, INTEGER) MAP NOT NULL"); {code}
The result is:
{noformat}
java.lang.AssertionError: Query: values (map[1, null])
Expected: is "(INTEGER NOT NULL, INTEGER) MAP NOT NULL"
but: was "(INTEGER NOT NULL, NULL) MAP NOT NULL"
{noformat}
however, the actual result "(INTEGER NOT NULL, NULL) MAP NOT NULL" for this
case is wrong. If we switch to this case it throw another exception:
{noformat}
java.lang.AssertionError: Query: select map[p0, null] from (values (1)) as t(p0)
Expected: is "(INTEGER NOT NULL, NULL) MAP NOT NULL"
but: was "(INTEGER NOT NULL, INTEGER) MAP NOT NULL"
{noformat}
No matter how you write this result type in test case, it is wrong.
but if we use
{code:java}
f.check("select map[1, null]", "{1=null}", "(INTEGER NOT NULL, INTEGER) MAP NOT
NULL"); {code}
it works.
the reason is [1, null] will do leastRestrictive, the null will cast to
Integer, so the end result type is (INTEGER NOT NULL, INTEGER), but the temp
type is (INTEGER NOT NULL, NULL).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)