Github user zhichao-li commented on a diff in the pull request:
https://github.com/apache/spark/pull/10731#discussion_r51985716
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
---
@@ -456,21 +455,32 @@ class SQLQuerySuite extends QueryTest with
SharedSQLContext {
test("literal in agg grouping expressions") {
checkAnswer(
- sql("SELECT a, count(1) FROM testData2 GROUP BY a, 1"),
- Seq(Row(1, 2), Row(2, 2), Row(3, 2)))
+ sql("SELECT SUM(a) FROM testData2 GROUP BY 2"),
+ Seq(Row(6), Row(6)))
+
checkAnswer(
- sql("SELECT a, count(2) FROM testData2 GROUP BY a, 2"),
+ sql("SELECT a, SUM(b) FROM testData2 GROUP BY 1"),
+ Seq(Row(1, 3), Row(2, 3), Row(3, 3)))
+
+ checkAnswer(
+ sql("SELECT a, count(1) FROM testData2 GROUP BY a, 1"),
Seq(Row(1, 2), Row(2, 2), Row(3, 2)))
checkAnswer(
sql("SELECT a, 1, sum(b) FROM testData2 GROUP BY a, 1"),
--- End diff --
`1` would be refer to the first index of columns for group by which is `a`
for this case. kind of redundant here.
---
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]