[jira] [Commented] (CALCITE-3213) Support complex type expressions for SqlDataTypeSpec

2019-08-19 Thread Danny Chan (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16910954#comment-16910954
 ] 

Danny Chan commented on CALCITE-3213:
-

Thanks Julian, the change list you proposed is much better and accurate, a big 
+1 !

> 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(
> foo NUMBER(5, 2) NOT NULL,
> rec ROW(b BOOLEAN, i MyUDT NOT NULL))
> {code}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3213) Support complex type expressions for SqlDataTypeSpec

2019-08-19 Thread Julian Hyde (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16910624#comment-16910624
 ] 

Julian Hyde commented on CALCITE-3213:
--

Sounds like a good list, and it will be a major improvement that complex types 
are treated as first class objects.

Minor point, but whenever you can, describe a change in terms of its SQL 
syntax. (When you talk about "SqlDataTypeSpec" you are narrowing the audience 
to people who actually write Calcite code or use its APIs, but everyone 
understands what you mean when you use SQL.) Also, capitalize the SQL keywords.

Here's my attempt to re-work your list. Please correct any inaccuracies.
 * Anonymous type based on ROW
 * Anonymous type based on ARRAY
 * Anonymous type based on nested collection (ARRAY and MULTISET)
 * In TIME and TIMESTAMP types, allow WITH TIME ZONE and WITH LOCAL TIME ZONE 
variants
 * Allow collection type (ARRAY and MULTISET) and NOT NULL in CREATE TYPE

> 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(
> foo NUMBER(5, 2) NOT NULL,
> rec ROW(b BOOLEAN, i MyUDT NOT NULL))
> {code}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3213) Support complex type expressions for SqlDataTypeSpec

2019-08-16 Thread Danny Chan (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909552#comment-16909552
 ] 

Danny Chan commented on CALCITE-3213:
-

Let me summarize the broad changes:
 * Support row type
 * Support array type
 * Support nested collection type
 * Support time zone definition for time and timestamp type
 * Support collection type for UDT and fix it's nullability

> 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(
> foo NUMBER(5, 2) NOT NULL,
> rec ROW(b BOOLEAN, i MyUDT NOT NULL))
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (CALCITE-3213) Support complex type expressions for SqlDataTypeSpec

2019-07-29 Thread Julian Hyde (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16895502#comment-16895502
 ] 

Julian Hyde commented on CALCITE-3213:
--

I do support the general idea that there should be a SQL representation for 
every type, complex or simple, even if we go beyond the SQL standard in doing 
this. Good languages have full support for anonymous types (i.e. specifying the 
type definition inline, rather than having to define the type beforehand and 
reference it by name).

> 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)


[jira] [Commented] (CALCITE-3213) Support complex type expressions for SqlDataTypeSpec

2019-07-28 Thread Danny Chan (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 
 [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)


[jira] [Commented] (CALCITE-3213) Support complex type expressions for SqlDataTypeSpec

2019-07-26 Thread Stamatis Zampetakis (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16893375#comment-16893375
 ] 

Stamatis Zampetakis commented on CALCITE-3213:
--

I am a bit confused with this syntax; where is it supposed to be used? For 
defining a structured type we use the {{CREATE TYPE}} syntax not the {{ROW}} 
constructor. 



> 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)


[jira] [Commented] (CALCITE-3213) Support complex type expressions for SqlDataTypeSpec

2019-07-25 Thread Julian Hyde (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16893314#comment-16893314
 ] 

Julian Hyde commented on CALCITE-3213:
--

I generally agree. Can you clarify: is that SQL standard syntax?

Also, I recall that standard SQL does not like {{NOT NULL}} constraints in 
complex types. (Not that we shouldn't do them. I just want to be clear what is 
standard and what is not.)

> 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)