[
https://issues.apache.org/jira/browse/CALCITE-5961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17766947#comment-17766947
]
xiong duan commented on CALCITE-5961:
-------------------------------------
Fixed in
[abb3e5b|https://github.com/apache/calcite/commit/abb3e5be43c9d030bea6489cc8ee42a2905fc4e8].
Thanks for the PR [~taoran] .
> Type inference of ARRAY_COMPACT is incorrect
> --------------------------------------------
>
> Key: CALCITE-5961
> URL: https://issues.apache.org/jira/browse/CALCITE-5961
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.35.0
> Reporter: Ran Tao
> Assignee: Ran Tao
> Priority: Major
> Labels: pull-request-available
>
> The return type of
> {code:java}
> array_compact(array[null, 1, null, 2]){code}
> is INTEGER ARRAY NOT NULL, but from semantics the correct type should be
> INTEGER NOT NULL ARRAY NOT NULL.
> because the returned result can not has NULL value.
> currently, array_compact use ARG0_NULLABLE which is not enough.
> {code:java}
> public static final SqlFunction ARRAY_COMPACT =
> SqlBasicFunction.create(SqlKind.ARRAY_COMPACT,
> ReturnTypes.ARG0_NULLABLE,
> OperandTypes.ARRAY);{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)