Skip to content

Commit

Permalink
Merge pull request #1 from marmbrus/pr/690
Browse files Browse the repository at this point in the history
Fix for SPARK-1757
  • Loading branch information
ash211 committed May 8, 2014
2 parents 8f3f281 + 54bd00e commit 747a0b9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ object ScalaReflection {

/** Returns a catalyst DataType for the given Scala Type using reflection. */
def schemaFor(tpe: `Type`): DataType = tpe match {
case t if t <:< typeOf[Option[_]] =>
val TypeRef(_, _, Seq(optType)) = t
schemaFor(optType)
case t if t <:< typeOf[Product] =>
val params = t.member("<init>": TermName).asMethod.paramss
StructType(
Expand All @@ -59,9 +62,6 @@ object ScalaReflection {
case t if t <:< typeOf[String] => StringType
case t if t <:< typeOf[Timestamp] => TimestampType
case t if t <:< typeOf[BigDecimal] => DecimalType
case t if t <:< typeOf[Option[_]] =>
val TypeRef(_, _, Seq(optType)) = t
schemaFor(optType)
case t if t <:< typeOf[java.lang.Integer] => IntegerType
case t if t <:< typeOf[java.lang.Long] => LongType
case t if t <:< typeOf[java.lang.Double] => DoubleType
Expand Down

0 comments on commit 747a0b9

Please sign in to comment.