Skip to content

Conversation

@dongjoon-hyun
Copy link
Member

What changes were proposed in this pull request?

GROUP-BY clauses raise AnalysisException for aliases while ORDER-BY clauses support them correctly. This PR aims to support aliases in GROUP-BY clause. This is one of frequently-used syntax to avoid unnecessary repetition.

scala> sql("select 1 a group by a").head
org.apache.spark.sql.AnalysisException: cannot resolve '`a`' given input columns: []; line 1 pos 20
scala> sql("select 1 a order by a").head
res1: org.apache.spark.sql.Row = [1]

How was this patch tested?

Pass the Jenkins tests (including a new testcase)

```
sql("select a x from values 1 T(a) group by x").explain
org.apache.spark.sql.AnalysisException: cannot resolve '`x`' given input columns: [a]; line 1 pos 39
```
@gatorsmile
Copy link
Member

gatorsmile commented Apr 29, 2016

Thanks for doing this! @dongjoon-hyun

We already saw multiple PRs for supporting this. You can search the history and find the reasons why we did not accept them.

@dongjoon-hyun
Copy link
Member Author

Opps. Thank you for notifying me. I'll.

@dongjoon-hyun
Copy link
Member Author

Oh, Spark prefers ordinal. Thank you again, @gatorsmile .
I'll close this PR and JIRA together now.

@SparkQA
Copy link

SparkQA commented Apr 30, 2016

Test build #57380 has finished for PR 12794 at commit 71249cf.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants