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

    https://github.com/apache/spark/pull/17191#discussion_r106096009
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 
---
    @@ -2586,4 +2586,15 @@ class SQLQuerySuite extends QueryTest with 
SharedSQLContext {
         }
         assert(!jobStarted.get(), "Command should not trigger a Spark job.")
       }
    +
    +  test("SPARK-14471 Aliases in SELECT could be used in GROUP BY") {
    +    Seq((1, "a", 0), (2, "a", 1), (1, "a", 2)).toDF("k1", "k2", "v")
    +      .createOrReplaceTempView("t")
    +    checkAnswer(
    +      sql("SELECT k1 AS key1, k2 AS key2, SUM(v) FROM t GROUP BY key1, 
key2"),
    +      Row(1, "a", 2) :: Row(2, "a", 1) :: Nil)
    +    checkAnswer(
    +      sql("SELECT k1 AS key1, key1 + 1 AS key2, COUNT(1) FROM t GROUP BY 
key1, key2"),
    +      Row(1, 2, 2) :: Row(2, 3, 1) :: Nil)
    +  }
    --- End diff --
    
    I think the target of this pr just replaces unresolved exprs in grouping 
keys with resolved ones by using resolved exprs in SELECT clauses. So, I think 
we'd better to discuss the name collision case you described in follow-up other 
tickets.


---
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]

Reply via email to