[
https://issues.apache.org/jira/browse/CALCITE-2464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16720599#comment-16720599
]
Julian Hyde commented on CALCITE-2464:
--------------------------------------
Here's a SQL DDL example would might help crystalize this for many people:
{code}
CREATE TYPE ZipCode AS (
zip5 CHAR(5) NOT NULL,
zip4 CHAR(4));
CREATE TYPE Address AS (
street VARCHAR(20) NOT NULL,
street2 VARCHAR(20),
zip ZipCode NOT NULL,
city VARCHAR(20) NOT NULL);
CREATE TABLE Contacts (
name VARCHAR(20) NOT NULL,
address Address NOT NULL);
{code}
There is a similar example in
[server/.../type.iq|https://github.com/apache/calcite/blob/master/server/src/test/resources/sql/type.iq],
which seems to have NOT NULL working, so please highlight what would be the
new functionality.
> Allow to set nullability for columns of structured types
> --------------------------------------------------------
>
> Key: CALCITE-2464
> URL: https://issues.apache.org/jira/browse/CALCITE-2464
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.17.0
> Reporter: Stamatis Zampetakis
> Assignee: Julian Hyde
> Priority: Major
>
> Struct types are always not nullable. This can lead to bugs in many parts of
> Calcite (e.g., expression simplification, optimization, code generation) that
> are considering the nullability of a RelDataType.
> The method
> [isNullable|https://github.com/apache/calcite/blob/3c6b5ec759caadabb67f09d7a4963cc7d9386d0c/core/src/main/java/org/apache/calcite/rel/type/RelRecordType.java#L55]
> in the RelRecordType, which is used to represent a structured type, always
> returns false. The nullability of the RelRecordType should be a parameter in
> the constructor as it is the case for various other RelDataTypes.
> Additionally, the data type cache should also take into account the
> nullability of the type in order to return a correct equivalent.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)