[
https://issues.apache.org/jira/browse/CALCITE-6764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17912755#comment-17912755
]
Alessandro Solimando commented on CALCITE-6764:
-----------------------------------------------
[~mbudiu], you cite the SQL standard, could you provide the version you refer
to, plus chapter and section so people can easily double check, and possibly
quoting it verbatim here?
When you say that Calcite supporte creating a nullable field even if it's not a
column, you mean a derived field or what?
> Field access from a nullable ROW should be nullable
> ---------------------------------------------------
>
> Key: CALCITE-6764
> URL: https://issues.apache.org/jira/browse/CALCITE-6764
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.38.0
> Reporter: Mihai Budiu
> Assignee: Mihai Budiu
> Priority: Minor
> Labels: pull-request-available
>
> Consider the following SQL:
> {code:sql}
> CREATE TABLE T(p MAP<VARCHAR, ROW(k VARCHAR, v VARCHAR)>);
> SELECT p['a'].k FROM T;
> {code}
> The MAP values are ROW values, which can be null.
> The type of p['a'] is nullable, so p['a'].k should also be nullable.
> The validator will crash while validating this query with the following error:
> {code}
> java.lang.RuntimeException: java.lang.AssertionError: Conversion to
> relational algebra failed to preserve datatypes:
> validated type:
> RecordType(VARCHAR EXPR$0) NOT NULL
> converted type:
> RecordType(VARCHAR NOT NULL EXPR$0) NOT NULL
> rel:
> LogicalProject(EXPR$0=[ITEM($0, 'a').k])
> LogicalTableScan(table=[[schema, t]])
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)