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

Julian Hyde commented on CALCITE-5918:
--------------------------------------

For what it's worth, I don't think that standard SQL has a {{MAP}} type or 
{{MAP}} constructor. Calcite's existing {{MAP}} support was added in commit 
[645235525|https://github.com/apache/calcite/commits/64523552520635e51fd731b64a13663f45b158d1]
 and I don't even remember which SQL dialect we based {{MAP}} on. ({{ARRAY}} 
and {{MULTISET}} are based on the SQL standard.)

An example of a {{MAP}} constructor is:
{code}
MAP ['washington', 1, 'obama', 44]
{code}

(This should be added to the table in the [SQL 
reference|https://calcite.apache.org/docs/reference.html#non-scalar-types].)

I guess this would be
{code}
MAP('washington', 1, 'obama', 44)
{code}
in your proposed syntax.

I have no objection to adding a {{MAP}} constructor consistent with Spark, just 
as we did for {{ARRAY}} in CALCITE-5624.

> Add MAP function (enabled in Spark library)
> -------------------------------------------
>
>                 Key: CALCITE-5918
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5918
>             Project: Calcite
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 1.35.0
>            Reporter: Guillaume Massé
>            Priority: Minor
>
> Apache Spark map constructor is different than the standard SQL:
> [https://spark.apache.org/docs/3.4.0/api/sql/index.html#map]
>  
> {code:java}
> SELECT map(1.0, '2', 3.0, '4');
> // {1.0:"2",3.0:"4"} {code}
>  
> related PR that can help implement this: 
> https://github.com/apache/calcite/pull/3141



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to