Skip to content

Commit 07e0498

Browse files
committed
Moving badRecords to JsonSuite
1 parent fc088df commit 07e0498

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,6 +2566,9 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData {
25662566

25672567
test("return partial result for bad records") {
25682568
val schema = "a double, b array<int>, c string, _corrupt_record string"
2569+
val badRecords = Seq(
2570+
"""{"a":"-","b":[0, 1, 2],"c":"abc"}""",
2571+
"""{"a":0.1,"b":{},"c":"def"}""").toDS()
25692572
val df = spark.read.schema(schema).json(badRecords)
25702573

25712574
checkAnswer(

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,6 @@ private[json] trait TestJsonData {
229229
"""{"date": "27/10/2014 18:30"}""" ::
230230
"""{"date": "28/01/2016 20:00"}""" :: Nil))(Encoders.STRING)
231231

232-
def badRecords: Dataset[String] =
233-
spark.createDataset(spark.sparkContext.parallelize(
234-
"""{"a":"-","b":[0, 1, 2],"c":"abc"}""" ::
235-
"""{"a":0.1,"b":{},"c":"def"}""" :: Nil))(Encoders.STRING)
236-
237232
lazy val singleRow: Dataset[String] =
238233
spark.createDataset(spark.sparkContext.parallelize("""{"a":123}""" :: Nil))(Encoders.STRING)
239234

0 commit comments

Comments
 (0)