spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiszk <...@git.apache.org>
Subject [GitHub] spark pull request #21258: [SPARK-23933][SQL] Add map_from_arrays function
Date Fri, 08 Jun 2018 00:55:43 GMT
Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21258#discussion_r193928013
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala
---
    @@ -235,6 +235,86 @@ case class CreateMap(children: Seq[Expression]) extends Expression
{
       override def prettyName: String = "map"
     }
     
    +/**
    + * Returns a catalyst Map containing the two arrays in children expressions as keys and
values.
    + */
    +@ExpressionDescription(
    +  usage = """
    +    _FUNC_(keys, values) - Creates a map with a pair of the given key/value arrays. All
elements
    +      in keys should not be null""",
    +  examples = """
    +    Examples:
    +      > SELECT _FUNC_([1.0, 3.0], ['2', '4']);
    +       {1.0:"2",3.0:"4"}
    +  """, since = "2.4.0")
    +case class CreateMapFromArrays(left: Expression, right: Expression)
    +    extends BinaryExpression with ExpectsInputTypes {
    +
    +  override def inputTypes: Seq[AbstractDataType] = Seq(ArrayType, ArrayType)
    +
    +  override def checkInputDataTypes(): TypeCheckResult = {
    --- End diff --
    
    sure, done


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message