[
https://issues.apache.org/jira/browse/CALCITE-6743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17907560#comment-17907560
]
Caican Cai commented on CALCITE-6743:
-------------------------------------
[~mbudiu] Thank you for correcting me on this issue. If you need a review PR,
you can @ me. I remember that many array functions have similar problems. I can
help test it on spark.
> 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
> Priority: Minor
>
> 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)