Github user mgaido91 commented on a diff in the pull request:
https://github.com/apache/spark/pull/21352#discussion_r202962701
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
---
@@ -168,27 +168,23 @@ case class ArraysZip(children: Seq[Expression])
extends Expression with ExpectsI
override def inputTypes: Seq[AbstractDataType] =
Seq.fill(children.length)(ArrayType)
- override def dataType: DataType = ArrayType(mountSchema)
-
- override def nullable: Boolean = children.exists(_.nullable)
-
- private lazy val arrayTypes =
children.map(_.dataType.asInstanceOf[ArrayType])
-
- private lazy val arrayElementTypes = arrayTypes.map(_.elementType)
-
- @transient private lazy val mountSchema: StructType = {
+ @transient override lazy val dataType: DataType = {
val fields = children.zip(arrayElementTypes).zipWithIndex.map {
case ((expr: NamedExpression, elementType), _) =>
StructField(expr.name, elementType, nullable = true)
case ((_, elementType), idx) =>
StructField(idx.toString, elementType, nullable = true)
}
- StructType(fields)
+ ArrayType(StructType(fields), containsNull = false)
}
- @transient lazy val numberOfArrays: Int = children.length
+ override def nullable: Boolean = children.exists(_.nullable)
+
+ @transient private lazy val arrayElementTypes = {
--- End diff --
nit: I think we don't need the braces
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]