[
https://issues.apache.org/jira/browse/CALCITE-5570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17699374#comment-17699374
]
Julian Hyde commented on CALCITE-5570:
--------------------------------------
Thanks for raising this, [~Sergey Nuyanzin]. We are indeed drifting into a
decision on how to support “parametrized types”, also known as “type
constructors”.
The standard has single argument type constructors ARRAY and MULTISET. They are
used postfix. No parentheses are required. Examples: INT ARRAY, BOOLEAN
MULTISET MULTISET. The standard does not use brackets in types, as far as I
know.
In CALCITE-4496 I have started using MEASURE as a type constructor, e.g.
MEASURE<INTEGER>.
BigQuery uses bracketed types a lot, e.g. ARRAY<INT>. So does Databricks, e.g.
{noformat}
SELECT CAST(map(struct('Hello', 'World'), 'Greeting') AS MAP<STRUCT<w1:string,
w2:string>, string>);
{{Hello, World}->Greeting}
{noformat}
I would like to introduce closures at some point, and they would have function
types such as FUNCTION<INTEGER, BOOLEAN>.
How do other dialects of SQL do parameterized types? Do any use square brackets
or parentheses?
If we decide to use angle brackets in Calcite then ARRAY<INTEGER> should be a
synonym for the standard INTEGER ARRAY.
> Support nested map type for SqlDataTypeSpec
> -------------------------------------------
>
> Key: CALCITE-5570
> URL: https://issues.apache.org/jira/browse/CALCITE-5570
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Sergey Nuyanzin
> Assignee: Jiajun Xie
> Priority: Major
> Labels: pull-request-available
> Time Spent: 40m
> Remaining Estimate: 0h
>
> There was added a similar support for arrays/multisets at
> https://issues.apache.org/jira/browse/CALCITE-3250
> however there is no support for maps so far.
> The issue is to add such support.
>
> I think I'd like to clarify is syntax for maps since it has 2 internal
> subtypes for keys and values may be something similar to ROW with delimiter
> like
> {code:sql}
> SELECT CAST(NULL AS MAP(INT, INT));
> -- or with square brackets similar to map constructor
> SELECT CAST(NULL AS MAP[INT, INT]);
> -- or with angle (Flink syntax)
> SELECT CAST(NULL AS MAP<INT, INT>);
> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)