Skip to content
Closed
Show file tree
Hide file tree
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
fix tests
  • Loading branch information
marmbrus committed Nov 12, 2015
commit f2474970c1b4b4de44fd30f80ef7fdd73742facc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ object ExtractValue {
case class GetStructField(child: Expression, field: StructField, ordinal: Int)
extends UnaryExpression {

override def dataType: DataType = child.dataType.asInstanceOf[StructType](ordinal).dataType
override def dataType: DataType = child.dataType match {
case s: StructType => s(ordinal).dataType
// This is a hack to avoid breaking existing code until we remove the need for the struct field
case _ => field.dataType
}
override def nullable: Boolean = child.nullable || field.nullable
override def toString: String = s"$child.${field.name}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class ExpressionEncoderSuite extends SparkFunSuite {
}
val convertedData = encoder.toRow(inputData)
val schema = encoder.schema.toAttributes
val boundEncoder = encoder.resolve(schema)
val boundEncoder = encoder.resolve(schema).bind(schema)
val convertedBack = try boundEncoder.fromRow(convertedData) catch {
case e: Exception =>
fail(
Expand Down