You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2026/08/09 05:23:00 UTC

[jira] [Resolved] (CALCITE-6743) Type inference for ARRAY_INSERT function produces an inconsistent result

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

Mihai Budiu resolved CALCITE-6743.
----------------------------------
    Fix Version/s: 1.43.0
       Resolution: Fixed

Fixed in https://github.com/apache/calcite/commit/1110bb11cfefea45d126607c246a69882bd5d366
Thank you for the review [~caicancai]

> 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
>            Assignee: Mihai Budiu
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.43.0
>
>
> 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)