[ 
https://issues.apache.org/jira/browse/CALCITE-6040?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ran Tao updated CALCITE-6040:
-----------------------------
    Description: 
we have a simple test case:
{code:java}
f.checkScalar("map[1, null]", "{1=null}",
"(INTEGER NOT NULL, NULL) MAP NOT NULL"); {code}
The result is:
{noformat}
java.lang.AssertionError: Query: values (map[1, null])
Expected: is "(INTEGER NOT NULL, NULL) MAP NOT NULL"
     but: was "(INTEGER NOT NULL, INTEGER) MAP NOT NULL"
{noformat}
however, the asserted actual result "(INTEGER NOT NULL, INTEGER) MAP NOT NULL" 
for this case is wrong. If we switch to  this asserted actual result it throws 
another exception:
{noformat}
java.lang.AssertionError: Query: select map[p0, null] from (values (1)) as t(p0)
Expected: is "(INTEGER NOT NULL, INTEGER) MAP NOT NULL"
     but: was "(INTEGER NOT NULL, NULL) MAP NOT NULL"
{noformat}
No matter how you write this result type in test case, it is wrong. 

by showing the plan, it seems the deduced value type has converted to INTEGER.
{noformat}
0: jdbc:calcite:model=src/test/resources/mode> explain plan for select map[1, 
null];
+------------------------------------------------------------------------------------------------------------+
|                                                    PLAN                       
                             |
+------------------------------------------------------------------------------------------------------------+
| EnumerableCalc(expr#0=[\{inputs}], expr#1=[1], expr#2=[null:INTEGER], 
expr#3=[MAP($t1, $t2)], EXPR$0=[$t3])
  EnumerableValues(tuples=[[\{ 0 }]])
 |
+------------------------------------------------------------------------------------------------------------+
{noformat}

  was:
we have a simple test case:
{code:java}
f.checkScalar("map[1, null]", "{1=null}",
"(INTEGER NOT NULL, NULL) MAP NOT NULL"); {code}
The result is:
{noformat}
java.lang.AssertionError: Query: values (map[1, null])
Expected: is "(INTEGER NOT NULL, NULL) MAP NOT NULL"
     but: was "(INTEGER NOT NULL, INTEGER) MAP NOT NULL"
{noformat}
however, the asserted actual result "(INTEGER NOT NULL, INTEGER) MAP NOT NULL" 
for this case is wrong. If we switch to  this asserted actual result it throws 
another exception:
{noformat}
java.lang.AssertionError: Query: select map[p0, null] from (values (1)) as t(p0)
Expected: is "(INTEGER NOT NULL, INTEGER) MAP NOT NULL"
     but: was "(INTEGER NOT NULL, NULL) MAP NOT NULL"
{noformat}
No matter how you write this result type in test case, it is wrong. 

by showing the plan, it seems the deduced value type has converted to INTEGER.

{noformat}

0: jdbc:calcite:model=src/test/resources/mode> explain plan for select 
map['washington', null];
+------------------------------------------------------------------------------------------------------------------------+
|                                                          PLAN                 
                                         |
+------------------------------------------------------------------------------------------------------------------------+
| EnumerableCalc(expr#0=[\{inputs}], expr#1=['washington'], 
expr#2=[null:CHAR(10)], expr#3=[MAP($t1, $t2)], EXPR$0=[$t3])
  EnumerableValues(tuples=[ |
{noformat}


> 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
>            Priority: Major
>
> we have a simple test case:
> {code:java}
> f.checkScalar("map[1, null]", "{1=null}",
> "(INTEGER NOT NULL, NULL) MAP NOT NULL"); {code}
> The result is:
> {noformat}
> java.lang.AssertionError: Query: values (map[1, null])
> Expected: is "(INTEGER NOT NULL, NULL) MAP NOT NULL"
>      but: was "(INTEGER NOT NULL, INTEGER) MAP NOT NULL"
> {noformat}
> however, the asserted actual result "(INTEGER NOT NULL, INTEGER) MAP NOT 
> NULL" for this case is wrong. If we switch to  this asserted actual result it 
> throws another exception:
> {noformat}
> java.lang.AssertionError: Query: select map[p0, null] from (values (1)) as 
> t(p0)
> Expected: is "(INTEGER NOT NULL, INTEGER) MAP NOT NULL"
>      but: was "(INTEGER NOT NULL, NULL) MAP NOT NULL"
> {noformat}
> No matter how you write this result type in test case, it is wrong. 
> by showing the plan, it seems the deduced value type has converted to INTEGER.
> {noformat}
> 0: jdbc:calcite:model=src/test/resources/mode> explain plan for select map[1, 
> null];
> +------------------------------------------------------------------------------------------------------------+
> |                                                    PLAN                     
>                                |
> +------------------------------------------------------------------------------------------------------------+
> | EnumerableCalc(expr#0=[\{inputs}], expr#1=[1], expr#2=[null:INTEGER], 
> expr#3=[MAP($t1, $t2)], EXPR$0=[$t3])
>   EnumerableValues(tuples=[[\{ 0 }]])
>  |
> +------------------------------------------------------------------------------------------------------------+
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to