You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Kazuaki Ishizaki (JIRA)" <ji...@apache.org> on 2018/04/18 16:23:00 UTC
[jira] [Comment Edited] (SPARK-23933) High-order function: map(array, array) → map
[ https://issues.apache.org/jira/browse/SPARK-23933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16436976#comment-16436976 ]
Kazuaki Ishizaki edited comment on SPARK-23933 at 4/18/18 4:22 PM:
-------------------------------------------------------------------
[~smilegator] [~ueshin] Could you favor us?
SparkSQL already uses syntax of {{map}} function for the different purpose.
Even if we limit two array in the argument list, we may have conflict between this new feature and creating a map with one entry having an array for key and value. Do you have any good idea?
{code}
@ExpressionDescription(
usage = "_FUNC_(key0, value0, key1, value1, ...) - Creates a map with the given key/value pairs.",
examples = """
Examples:
> SELECT _FUNC_(1.0, '2', 3.0, '4');
{1.0:"2",3.0:"4"}
""")
case class CreateMap(children: Seq[Expression]) extends Expression {
...
{code}
was (Author: kiszk):
[~smilegator] [~ueshin] Could you favor us?
SparkSQL already uses syntax of {{map}} function for the similar purpose.
Even if we limit two array in the argument list, we may have conflict between this new feature and creating a map with one entry having an array for key and value. Do you have any good idea?
{code}
@ExpressionDescription(
usage = "_FUNC_(key0, value0, key1, value1, ...) - Creates a map with the given key/value pairs.",
examples = """
Examples:
> SELECT _FUNC_(1.0, '2', 3.0, '4');
{1.0:"2",3.0:"4"}
""")
case class CreateMap(children: Seq[Expression]) extends Expression {
...
{code}
> High-order function: map(array<K>, array<V>) → map<K,V>
> -------------------------------------------------------
>
> Key: SPARK-23933
> URL: https://issues.apache.org/jira/browse/SPARK-23933
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 2.3.0
> Reporter: Xiao Li
> Priority: Major
>
> Ref: https://prestodb.io/docs/current/functions/map.html
> Returns a map created using the given key/value arrays.
> {noformat}
> SELECT map(ARRAY[1,3], ARRAY[2,4]); -- {1 -> 2, 3 -> 4}
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org