[ 
https://issues.apache.org/jira/browse/CALCITE-5772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

jackylau updated CALCITE-5772:
------------------------------
    Description: 
h3. 
[map_concat|https://spark.apache.org/docs/latest/api/sql/index.html#map_concat]

map_concat(map, ...) - Returns the union of all the given maps

*Examples:*

{{> SELECT map_concat(map(1, 'a', 2, 'b'), map(3, 'c'));
 {1:"a",2:"b",3:"c"}}}

{{}}
h3. 
[map_from_entries|https://spark.apache.org/docs/latest/api/sql/index.html#map_from_entries]

map_from_entries(arrayOfEntries) - Returns a map created from the given array 
of entries.

*Examples:*

 

{{{}> SELECT map_from_entries(array(struct(1, 'a'), struct(2, 'b')));
 {1:"a",2:"b"}{}}}{{{}{}}}

  was:
MAP_FROM_ARRAYS (array1, array2)
 * Returns a map created from an *array1* and *array2. Note that the lengths of 
two arrays should be the same

{code:java}
// code placeholder
> SELECT map_from_arrays(array(1.0, 3.0), array('2', '4'));
 {1.0:"2",3.0:"4"} {code}
 

 

STR_TO_MAP(string[, stringDelimiter[, keyValueDelimiter]])
 - Returns a map after splitting the *string* into key/value pairs using 
delimiters. Default delimiters are ',' for *stringDelimiter* and ':' for 
*keyValueDelimiter* Both {{pairDelim}} and {{keyValueDelim}} are treated as 
regular expressions.

*Examples:*
{code:java}
> SELECT str_to_map('a:1,b:2,c:3', ',', ':');

- {"a":"1","b":"2","c":"3"}

> SELECT str_to_map('a');
 {"a":null} {code}
 

 (array1, array2)
 * Returns a map created from an *array1* and *array2. Note that the lengths of 
two arrays should be the same

{code:java}
// code placeholder
> SELECT map_from_arrays(array(1.0, 3.0), array('2', '4'));
 {1.0:"2",3.0:"4"} {code}
 

 

STR_TO_MAP(string[, stringDelimiter[, keyValueDelimiter]])
 - Returns a map after splitting the *string* into key/value pairs using 
delimiters. Default delimiters are ',' for *stringDelimiter* and ':' for 
*keyValueDelimiter* Both {{pairDelim}} and {{keyValueDelim}} are treated as 
regular expressions.

*Examples:*
{code:java}
> SELECT str_to_map('a:1,b:2,c:3', ',', ':');

- {"a":"1","b":"2","c":"3"}

> SELECT str_to_map('a');
 {"a":null} {code}
 


> Add MAP_CONCAT, MAP_FROM_ENTRIES  for Spark dialect
> ---------------------------------------------------
>
>                 Key: CALCITE-5772
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5772
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.35.0
>            Reporter: jackylau
>            Priority: Major
>             Fix For: 1.35.0
>
>
> h3. 
> [map_concat|https://spark.apache.org/docs/latest/api/sql/index.html#map_concat]
> map_concat(map, ...) - Returns the union of all the given maps
> *Examples:*
> {{> SELECT map_concat(map(1, 'a', 2, 'b'), map(3, 'c'));
>  {1:"a",2:"b",3:"c"}}}
> {{}}
> h3. 
> [map_from_entries|https://spark.apache.org/docs/latest/api/sql/index.html#map_from_entries]
> map_from_entries(arrayOfEntries) - Returns a map created from the given array 
> of entries.
> *Examples:*
>  
> {{{}> SELECT map_from_entries(array(struct(1, 'a'), struct(2, 'b')));
>  {1:"a",2:"b"}{}}}{{{}{}}}



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

Reply via email to