[ https://issues.apache.org/jira/browse/CALCITE-3213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16894902#comment-16894902 ]
Danny Chan commented on CALCITE-3213: ------------------------------------- The _NOT NULL_ constraints are not in the standard SQL according to SQL 2011[1]. This is true for the query data type declaration(in the cast expression or a literal). But for DDLs, most of the SQL vendors implement their table column constraint as default to be nullable [2] [3](which is also adopted by Calcite), and we use the SqlDataTypeSpec to describe the type when parse the column data type expressions. So support the _NOT NULL_ constraints for constructed data types seem necessary. There are ARRAY/MAP/Row enumerations in our SqlTypeFamily[4], but we do not have the implementation in SqlDataTypeSpec; We do not even support them very well for the parser, for example we can declare a table column as Row type and the parser would parse it as a AbstractSqlType with type name Row, but it does not contain any field definitions. [1] IWD 9075-2:201?(E) 6.1 <data type> [2] [https://www.sqlshack.com/commonly-used-sql-server-constraints-not-null-unique-primary-key/] [3] [https://www.tutorialspoint.com/postgresql/postgresql_constraints] [4] [https://github.com/apache/calcite/blob/689a5bbb14614d3f8eef4a4f7e832c6c02029b3c/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java#L65] > Support complex type expressions for SqlDataTypeSpec > ----------------------------------------------------- > > Key: CALCITE-3213 > URL: https://issues.apache.org/jira/browse/CALCITE-3213 > Project: Calcite > Issue Type: Improvement > Components: core > Affects Versions: 1.20.0 > Reporter: Danny Chan > Assignee: Danny Chan > Priority: Major > Fix For: 1.21.0 > > > We should support nested struct type like: > {code:sql} > ROW( > NUMBER(5, 2) NOT NULL AS foo, > ROW(BOOLEAN AS b, MyUDT NOT NULL AS i) AS rec) > {code} -- This message was sent by Atlassian JIRA (v7.6.14#76016)