Skip to content

Commit

Permalink
Add NullType support to RowEncoder.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Nov 22, 2015
1 parent ff442bb commit 6035a40
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object RowEncoder {
private def extractorsFor(
inputObject: Expression,
inputType: DataType): Expression = inputType match {
case BooleanType | ByteType | ShortType | IntegerType | LongType |
case NullType | BooleanType | ByteType | ShortType | IntegerType | LongType |
FloatType | DoubleType | BinaryType => inputObject

case udt: UserDefinedType[_] =>
Expand Down Expand Up @@ -143,6 +143,7 @@ object RowEncoder {
case _: MapType => ObjectType(classOf[scala.collection.Map[_, _]])
case _: StructType => ObjectType(classOf[Row])
case udt: UserDefinedType[_] => ObjectType(udt.userClass)
case _: NullType => ObjectType(classOf[java.lang.Object])
}

private def constructorFor(schema: StructType): Expression = {
Expand All @@ -158,7 +159,7 @@ object RowEncoder {
}

private def constructorFor(input: Expression): Expression = input.dataType match {
case BooleanType | ByteType | ShortType | IntegerType | LongType |
case NullType | BooleanType | ByteType | ShortType | IntegerType | LongType |
FloatType | DoubleType | BinaryType => input

case udt: UserDefinedType[_] =>
Expand Down

0 comments on commit 6035a40

Please sign in to comment.