Skip to content

Commit

Permalink
adding back some stddev codegen tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sethah committed Oct 23, 2015
1 parent cf8a14b commit b86386a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,13 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
testCodeGen(
"SELECT min(key) FROM testData3x",
Row(1) :: Nil)
// STDDEV
testCodeGen(
"SELECT a, stddev(b), stddev_pop(b) FROM testData2 GROUP BY a",
(1 to 3).map(i => Row(i, math.sqrt(0.5), math.sqrt(0.25))))
testCodeGen(
"SELECT stddev(b), stddev_pop(b), stddev_samp(b) FROM testData2",
Row(math.sqrt(1.5 / 5), math.sqrt(1.5 / 6), math.sqrt(1.5 / 5)) :: Nil)
// Some combinations.
testCodeGen(
"""
Expand All @@ -349,8 +356,8 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
Row(100, 1, 50.5, 300, 100) :: Nil)
// Aggregate with Code generation handling all null values
testCodeGen(
"SELECT sum('a'), avg('a'), count(null) FROM testData",
Row(null, null, 0) :: Nil)
"SELECT sum('a'), avg('a'), stddev('a'), count(null) FROM testData",
Row(null, null, null, 0) :: Nil)
} finally {
sqlContext.dropTempTable("testData3x")
sqlContext.setConf(SQLConf.CODEGEN_ENABLED, originalValue)
Expand Down

0 comments on commit b86386a

Please sign in to comment.