You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by mn-mikke <gi...@git.apache.org> on 2018/07/16 13:13:30 UTC
[GitHub] spark pull request #21045: [SPARK-23931][SQL] Adds arrays_zip function to sp...
Github user mn-mikke commented on a diff in the pull request:
https://github.com/apache/spark/pull/21045#discussion_r202676603
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala ---
@@ -128,6 +128,172 @@ case class MapKeys(child: Expression)
override def prettyName: String = "map_keys"
}
+@ExpressionDescription(
+ usage = """
+ _FUNC_(a1, a2, ...) - Returns a merged array of structs in which the N-th struct contains all
+ N-th values of input arrays.
+ """,
+ examples = """
+ Examples:
+ > SELECT _FUNC_(array(1, 2, 3), array(2, 3, 4));
+ [[1, 2], [2, 3], [3, 4]]
+ > SELECT _FUNC_(array(1, 2), array(2, 3), array(3, 4));
+ [[1, 2, 3], [2, 3, 4]]
+ """,
+ since = "2.4.0")
+case class ArraysZip(children: Seq[Expression]) extends Expression with ExpectsInputTypes {
+
+ override def inputTypes: Seq[AbstractDataType] = Seq.fill(children.length)(ArrayType)
+
+ override def dataType: DataType = ArrayType(mountSchema)
--- End diff --
Just a quick follow up question... Under what circumstances does the output array can contain null elements? Shouldn't the output dataType be ```ArrayType(mountSchema, false)```?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org