Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/5138#discussion_r26951147
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
---
@@ -220,6 +220,19 @@ class SQLQuerySuite extends QueryTest with
BeforeAndAfterAll {
Seq(Row(1,3), Row(2,3), Row(3,3)))
}
+ test("SPARK-6451 SUM agg with code generation") {
+ val originalValue = conf.codegenEnabled
+ setConf(SQLConf.CODEGEN_ENABLED, "true")
+ checkAnswer(
+ sql("SELECT a, SUM(b), SUM(CAST(b as Double)) FROM testData2 GROUP
BY a"),
+ Seq(Row(1, 3, 3.0), Row(2, 3, 3.0), Row(3, 3, 3.0)))
+
+ checkAnswer(
+ sql("SELECT sum('a'), avg('a') FROM testData"),
+ Row(0, null))
+ setConf(SQLConf.CODEGEN_ENABLED, originalValue.toString)
+ }
+
--- End diff --
I also have some tests added in
https://github.com/yhuai/spark/blob/expressionType/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala#L107.
Can you combine my stuff into your test? I think we can use the test of
"aggregation with codegen" for now. Also, I think it is necessary to check the
plan to make sure we indeed have GeneratedAggregate.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]