Skip to content

Commit fb4fa7b

Browse files
committed
Correct schema
1 parent 02a742b commit fb4fa7b

File tree

1 file changed

+3
-5
lines changed
  • sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json

1 file changed

+3
-5
lines changed

sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonSuite.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,13 +1432,11 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData {
14321432
// Test if we can query corrupt records.
14331433
withSQLConf(SQLConf.COLUMN_NAME_OF_CORRUPT_RECORD.key -> "_unparsed") {
14341434
withTempTable("jsonTable") {
1435-
val jsonDF = sqlContext.read.json(additionalCorruptRecords)
1436-
jsonDF.registerTempTable("jsonTable")
14371435
val schema = StructType(
14381436
StructField("_unparsed", StringType, true) ::
1439-
StructField("dummy", StringType, true) :: Nil)
1440-
1441-
assert(schema === jsonDF.schema)
1437+
StructField("dummy", StringType, true) :: Nil)
1438+
val jsonDF = sqlContext.read.schema(schema).json(additionalCorruptRecords)
1439+
jsonDF.registerTempTable("jsonTable")
14421440

14431441
// In HiveContext, backticks should be used to access columns starting with a underscore.
14441442
checkAnswer(

0 commit comments

Comments
 (0)