[
https://issues.apache.org/jira/browse/CALCITE-5570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17701108#comment-17701108
]
Sergey Nuyanzin commented on CALCITE-5570:
------------------------------------------
{quote}I wonder whether it's possible to make MapSqlType, ArraySqlType,
MultisetSqlType extend ApplySqlType?
{quote}
it looks like it's possible. I submitted a draft pr just for POC[1] purpose.
Not sure whether this change should be within this issue or could be
independent.
{quote}Also, should SqlTypeName have a field that is the number of type
parameters (0 for most, 1 for measure, array and multiset, 2 for map)?
{quote}
That's still not clear... because there are other SqlTypeNames e.g. ROW with
unpredictable number of parameters or DYNAMIC_STAR, STRUCTURED.... Not sure
that 0 is ok for these SqlTypeNames.
{quote}Note that array should continue to unparse as 'T ARRAY', but we should
parse both 'T ARRAY' and 'ARRAY<T>'. Similarly MULTISET.
{quote}
Then there could be a question: in case there is a type {{ARRAY<MAP<ARRAY<INT>,
ARRAY<INT>>>}} should it be unparsed like {{{}INT ARRAY INT ARRAY MAP ARRAY{}}}?
[1] https://github.com/apache/calcite/pull/3118
> 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: 50m
> 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)