Skip to content

Commit

Permalink
remove unnecessary resolved assertion inside dataType method
Browse files Browse the repository at this point in the history
  • Loading branch information
yjshen committed Jul 2, 2015
1 parent fd3cd8e commit 828d694
Showing 1 changed file with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ case class CreateNamedStruct(children: Seq[Expression]) extends Expression {
private lazy val names = nameExprs.map(_.asInstanceOf[Literal].value.toString)

override lazy val dataType: StructType = {
assert(resolved, resolveFailureMessage)
val fields = names.zip(valExprs).map { case (name, valExpr) =>
StructField(name, valExpr.dataType, valExpr.nullable, Metadata.empty)
}
Expand Down Expand Up @@ -125,12 +124,4 @@ case class CreateNamedStruct(children: Seq[Expression]) extends Expression {
override def eval(input: InternalRow): Any = {
InternalRow(valExprs.map(_.eval(input)): _*)
}

private def resolveFailureMessage(): String = {
if (!childrenResolved) {
s"CreateNamedStruct contains unresolvable children: ${children.filterNot(_.resolved)}."
} else {
checkInputDataTypes().asInstanceOf[TypeCheckFailure].message
}
}
}

0 comments on commit 828d694

Please sign in to comment.