Skip to content

Commit 7a6a7e5

Browse files
committed
Fix bug introduced by the change made on SQLContext.inferSchema.
1 parent 43a45e1 commit 7a6a7e5

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,15 @@ class SQLContext(@transient val sparkContext: SparkContext)
375375
import scala.collection.JavaConversions._
376376
def typeOfComplexValue: PartialFunction[Any, DataType] = {
377377
case c: java.util.List[_] =>
378-
ArrayType(ScalaReflection.typeOfObject(c.head))
378+
ArrayType(typeOfObject(c.head))
379379
case c: java.util.Set[_] =>
380-
ArrayType(ScalaReflection.typeOfObject(c.head))
380+
ArrayType(typeOfObject(c.head))
381381
case c: java.util.Map[_, _] =>
382382
val (key, value) = c.head
383-
MapType(
384-
ScalaReflection.typeOfObject(key),
385-
ScalaReflection.typeOfObject(value))
383+
MapType(typeOfObject(key), typeOfObject(value))
386384
case c if c.getClass.isArray =>
387385
val elem = c.asInstanceOf[Array[_]].head
388-
ArrayType(ScalaReflection.typeOfObject(elem))
386+
ArrayType(typeOfObject(elem))
389387
case c => throw new Exception(s"Object of type $c cannot be used")
390388
}
391389

sql/core/src/main/scala/org/apache/spark/sql/json/JsonRDD.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import org.apache.spark.sql.Logging
3131

3232
private[sql] object JsonRDD extends Logging {
3333

34-
def jsonStringToRow(schema: StructType, jsonIter: Iterator[String]): Iterator[Row] = {
34+
private[sql] def jsonStringToRow(schema: StructType, jsonIter: Iterator[String]): Iterator[Row] = {
3535
parseJson(jsonIter).map(parsed => asRow(parsed, schema))
3636
}
3737

0 commit comments

Comments
 (0)