Skip to content

Commit

Permalink
Remove explicit conversion to avoid NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
marmbrus committed Sep 8, 2014
1 parent 26bc765 commit 59065bc
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ class SQLContext(@transient val sparkContext: SparkContext)
rdd: RDD[Array[Any]],
schema: StructType): SchemaRDD = {
import scala.collection.JavaConversions._
import scala.collection.convert.Wrappers.{JListWrapper, JMapWrapper}

def needsConversion(dataType: DataType): Boolean = dataType match {
case ByteType => true
Expand All @@ -482,8 +481,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
case (null, _) => null

case (c: java.util.List[_], ArrayType(elementType, _)) =>
val converted = c.map { e => convert(e, elementType)}
JListWrapper(converted)
c.map { e => convert(e, elementType)}: Seq[Any]

case (c, ArrayType(elementType, _)) if c.getClass.isArray =>
c.asInstanceOf[Array[_]].map(e => convert(e, elementType)): Seq[Any]
Expand Down

0 comments on commit 59065bc

Please sign in to comment.