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 2025/03/28 02:23:00 UTC
[jira] [Resolved] (CALCITE-6920) The type derived for a cast to INT ARRAY always has non-nullable elements
[ https://issues.apache.org/jira/browse/CALCITE-6920?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mihai Budiu resolved CALCITE-6920.
----------------------------------
Fix Version/s: 1.40.0
Resolution: Fixed
Fixed in https://github.com/apache/calcite/commit/c4b0b2e7bf859a9b045389f323f7b678226caa04
Thank you for the review [~caicancai]
> The type derived for a cast to INT ARRAY always has non-nullable elements
> -------------------------------------------------------------------------
>
> Key: CALCITE-6920
> URL: https://issues.apache.org/jira/browse/CALCITE-6920
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.39.0
> Reporter: Mihai Budiu
> Assignee: Mihai Budiu
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.40.0
>
>
> Consider an expression such as SELECT CAST(variant AS INT ARRAY).
> The type inference produces a type of INTEGER NOT NULL ARRAY.
> This is incorrect, since the elements of the array could be nulls.
> This happens because SqlCollectionTypeNameSpec.deriveType never produces nullable types for collection elements.
> Notice that one cannot write INT NULL ARRAY or INT NOT NULL ARRAY.
> A conservative implementation should always produce a nullable element type.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)