Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11846#discussion_r56991806
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 
---
    @@ -459,25 +460,103 @@ class SQLQuerySuite extends QueryTest with 
SharedSQLContext {
           Seq(Row(1, 3), Row(2, 3), Row(3, 3)))
       }
     
    -  test("literal in agg grouping expressions") {
    +  test("Group By Ordinal - basic") {
         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, count(2) FROM testData2 GROUP BY a, 2"),
    -      Seq(Row(1, 2), Row(2, 2), Row(3, 2)))
    +      sql("SELECT a, sum(b) FROM testData2 GROUP BY 1"),
    +      sql("SELECT a, sum(b) FROM testData2 GROUP BY a"))
     
    +    // duplicate group-by columns
         checkAnswer(
           sql("SELECT a, 1, sum(b) FROM testData2 GROUP BY a, 1"),
           sql("SELECT a, 1, sum(b) FROM testData2 GROUP BY a"))
    +
    +    checkAnswer(
    +      sql("SELECT a, 1, sum(b) FROM testData2 GROUP BY 1, 2"),
    +      sql("SELECT a, 1, sum(b) FROM testData2 GROUP BY a"))
    +  }
    +
    +  test("Group By Ordinal - non aggregate expressions") {
    +    checkAnswer(
    +      sql("SELECT a, b + 2, count(2) FROM testData2 GROUP BY a, 2"),
    +      sql("SELECT a, b + 2, count(2) FROM testData2 GROUP BY a, b + 2"))
    +
    +    checkAnswer(
    +      sql("SELECT a, b + 2, count(2) FROM testData2 GROUP BY a, b + 2"),
    +      Seq(Row(1, 3, 1), Row(1, 4, 1), Row(2, 3, 1), Row(2, 4, 1), Row(3, 
3, 1), Row(3, 4, 1)))
    --- End diff --
    
    sure, will remove it. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to