Skip to content

Commit 50a03b0

Browse files
committed
Use JsonRDD.nullTypeToStringType to convert NullType to StringType.
1 parent 1eeb769 commit 50a03b0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ private[sql] case class JSONRelation(
4444
private def baseRDD = sqlContext.sparkContext.textFile(fileName)
4545

4646
override val schema = userSpecifiedSchema.getOrElse(
47-
JsonRDD.inferSchema(
48-
baseRDD,
49-
samplingRatio,
50-
sqlContext.columnNameOfCorruptRecord)
51-
)
47+
JsonRDD.nullTypeToStringType(
48+
JsonRDD.inferSchema(
49+
baseRDD,
50+
samplingRatio,
51+
sqlContext.columnNameOfCorruptRecord)))
5252

5353
override def buildScan() =
5454
JsonRDD.jsonStringToRow(baseRDD, schema, sqlContext.columnNameOfCorruptRecord)

0 commit comments

Comments
 (0)