Skip to content

Commit 0089a4f

Browse files
ueshinmarmbrus
authored andcommitted
[SPARK-4319][SQL] Enable an ignored test "null count".
Author: Takuya UESHIN <[email protected]> Closes #3185 from ueshin/issues/SPARK-4319 and squashes the following commits: a44a38e [Takuya UESHIN] Enable an ignored test "null count". (cherry picked from commit dbf1058) Signed-off-by: Michael Armbrust <[email protected]>
1 parent 19dcb57 commit 0089a4f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,13 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
281281
3)
282282
}
283283

284-
// No support for primitive nulls yet.
285-
ignore("null count") {
284+
test("null count") {
286285
checkAnswer(
287-
sql("SELECT a, COUNT(b) FROM testData3"),
288-
Seq((1,0), (2, 1)))
286+
sql("SELECT a, COUNT(b) FROM testData3 GROUP BY a"),
287+
Seq((1, 0), (2, 1)))
289288

290289
checkAnswer(
291-
testData3.groupBy()(Count('a), Count('b), Count(1), CountDistinct('a :: Nil), CountDistinct('b :: Nil)),
290+
sql("SELECT COUNT(a), COUNT(b), COUNT(1), COUNT(DISTINCT a), COUNT(DISTINCT b) FROM testData3"),
292291
(2, 1, 2, 2, 1) :: Nil)
293292
}
294293

sql/core/src/test/scala/org/apache/spark/sql/TestData.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ object TestData {
6464
BinaryData("123".getBytes(), 4) :: Nil).toSchemaRDD
6565
binaryData.registerTempTable("binaryData")
6666

67-
// TODO: There is no way to express null primitives as case classes currently...
67+
case class TestData3(a: Int, b: Option[Int])
6868
val testData3 =
69-
logical.LocalRelation('a.int, 'b.int).loadData(
70-
(1, null) ::
71-
(2, 2) :: Nil)
69+
TestSQLContext.sparkContext.parallelize(
70+
TestData3(1, None) ::
71+
TestData3(2, Some(2)) :: Nil).toSchemaRDD
72+
testData3.registerTempTable("testData3")
7273

7374
val emptyTableData = logical.LocalRelation('a.int, 'b.int)
7475

0 commit comments

Comments
 (0)