You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "jackylau (Jira)" <ji...@apache.org> on 2023/06/06 02:09:00 UTC
[jira] [Commented] (CALCITE-5744) Add MAP_FROM_ARRAYS, STR_TO_MAP for Spark dialect
[ https://issues.apache.org/jira/browse/CALCITE-5744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17729545#comment-17729545 ]
jackylau commented on CALCITE-5744:
-----------------------------------
change the description [~tanclary] ,thanks for your review
> Add MAP_FROM_ARRAYS, STR_TO_MAP for Spark dialect
> -------------------------------------------------
>
> Key: CALCITE-5744
> URL: https://issues.apache.org/jira/browse/CALCITE-5744
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.35.0
> Reporter: jackylau
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.35.0
>
>
> 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}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)