Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[SPARK-24305][SQL][FOLLOWUP] Addressing review comments
  • Loading branch information
mn-mikke committed Jul 17, 2018
commit fd3a94524b3916507381fd951d65d0a90afad38e
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,8 @@ case class ArraysZip(children: Seq[Expression]) extends Expression with ExpectsI

override def nullable: Boolean = children.exists(_.nullable)

@transient private lazy val arrayElementTypes = {
@transient private lazy val arrayElementTypes =
children.map(_.dataType.asInstanceOf[ArrayType].elementType)
}

private def genericArrayData = classOf[GenericArrayData].getName

Expand Down Expand Up @@ -356,7 +355,7 @@ case class MapEntries(child: Expression) extends UnaryExpression with ExpectsInp

override def inputTypes: Seq[AbstractDataType] = Seq(MapType)

private def childDataType: MapType = child.dataType.asInstanceOf[MapType]
@transient private lazy val childDataType: MapType = child.dataType.asInstanceOf[MapType]

override def dataType: DataType = {
ArrayType(
Expand Down Expand Up @@ -733,15 +732,14 @@ case class MapConcat(children: Seq[Expression]) extends ComplexTypeMergingExpres
since = "2.4.0")
case class MapFromEntries(child: Expression) extends UnaryExpression {

@transient private lazy val dataTypeDetails: Option[(MapType, Boolean, Boolean)] = {
child.dataType match {
case ArrayType(
StructType(Array(
StructField(_, kt, kn, _),
StructField(_, vt, vn, _))),
cn) => Some((MapType(kt, vt, vn), kn, cn))
case _ => None
}
@transient
private lazy val dataTypeDetails: Option[(MapType, Boolean, Boolean)] = child.dataType match {
case ArrayType(
StructType(Array(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the indentation seems wrong here.

StructField(_, keyType, keyNullable, _),
StructField(_, valueType, valueNullable, _))),
containsNull) => Some((MapType(keyType, valueType, valueNullable), keyNullable, containsNull))
case _ => None
}

@transient private lazy val nullEntries: Boolean = dataTypeDetails.get._3
Expand Down Expand Up @@ -990,9 +988,8 @@ trait ArraySortLike extends ExpectsInputTypes {
}
}

@transient lazy val elementType: DataType = {
@transient lazy val elementType: DataType =
arrayExpression.dataType.asInstanceOf[ArrayType].elementType
}

def containsNull: Boolean = arrayExpression.dataType.asInstanceOf[ArrayType].containsNull

Expand Down