Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-4319][SQL] Enable an ignored test "null count". #3185

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,13 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
3)
}

// No support for primitive nulls yet.
ignore("null count") {
test("null count") {
checkAnswer(
sql("SELECT a, COUNT(b) FROM testData3"),
Seq((1,0), (2, 1)))
sql("SELECT a, COUNT(b) FROM testData3 GROUP BY a"),
Seq((1, 0), (2, 1)))

checkAnswer(
testData3.groupBy()(Count('a), Count('b), Count(1), CountDistinct('a :: Nil), CountDistinct('b :: Nil)),
sql("SELECT COUNT(a), COUNT(b), COUNT(1), COUNT(DISTINCT a), COUNT(DISTINCT b) FROM testData3"),
(2, 1, 2, 2, 1) :: Nil)
}

Expand Down
9 changes: 5 additions & 4 deletions sql/core/src/test/scala/org/apache/spark/sql/TestData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ object TestData {
BinaryData("123".getBytes(), 4) :: Nil).toSchemaRDD
binaryData.registerTempTable("binaryData")

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

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

Expand Down