Skip to content
Prev Previous commit
Next Next commit
Update python dataFrame show test and add empty df unit test.
  • Loading branch information
云峤 committed May 4, 2015
commit a1338f636471e3f37f81b23e93871aa0b9459e7d
24 changes: 13 additions & 11 deletions sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -599,20 +599,22 @@ class DataFrameSuite extends QueryTest {
}

test("SPARK-7319 showString") {
assert(testData.select($"*").showString(1) === """+---+-----+
||key|value|
|+---+-----+
|| 1| 1|
|+---+-----+
|""".stripMargin)
val expectedAnswer = """+---+-----+
||key|value|
|+---+-----+
|| 1| 1|
|+---+-----+
|""".stripMargin
assert(testData.select($"*").showString(1) === expectedAnswer)
}

test("SPARK-7327 show with empty dataFrame") {
assert(testData.select($"*").filter($"key" < 0).showString(1) === """+---+-----+
||key|value|
|+---+-----+
|+---+-----+
|""".stripMargin)
val expectedAnswer = """+---+-----+
||key|value|
|+---+-----+
|+---+-----+
|""".stripMargin
assert(testData.select($"*").filter($"key" < 0).showString(1) === expectedAnswer)
}

test("createDataFrame(RDD[Row], StructType) should convert UDTs (SPARK-6672)") {
Expand Down