Mihai Budiu created CALCITE-6743:
------------------------------------

             Summary: Type inference for ARRAY_INSERT function produces an 
inconsistent result
                 Key: CALCITE-6743
                 URL: https://issues.apache.org/jira/browse/CALCITE-6743
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.38.0
            Reporter: Mihai Budiu


Consider this test:

{code}
select array_insert(array(1, 2, 3), 3, cast(4 as double))
{code}

The type inference for array_insert first infers a type of INTEGER ARRAY for 
the first argument of array_insert. That's correct. Then it infers a type of 
double for the last argument. That's also fine. 

Then it uses a function called adjustTypeForArrayFunction to rewrite the array 
constructor into array(1.0, 2.0, 3.0) with double arguments. Unfortunately the 
type in the typeMap for this array is never  adjusted, and remains INTEGER 
ARRAY, which is incorrect.




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

Reply via email to