You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Xiao Li (JIRA)" <ji...@apache.org> on 2018/01/22 21:41:00 UTC

[jira] [Resolved] (SPARK-20841) Support table column aliases in FROM clause

     [ https://issues.apache.org/jira/browse/SPARK-20841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Xiao Li resolved SPARK-20841.
-----------------------------
       Resolution: Fixed
    Fix Version/s: 2.3.0

> Support table column aliases in FROM clause
> -------------------------------------------
>
>                 Key: SPARK-20841
>                 URL: https://issues.apache.org/jira/browse/SPARK-20841
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.0.0
>            Reporter: Josh Rosen
>            Assignee: Takeshi Yamamuro
>            Priority: Minor
>             Fix For: 2.3.0
>
>
> Some SQL dialects support a relatively obscure "table column aliases" feature where you can rename columns when aliasing a relation in a {{FROM}} clause. For example:
> {code}
> SELECT * FROM onecolumn AS a(x) JOIN onecolumn AS b(y) ON a.x = b.y
> {code}
> Spark does not currently support this. I would like to add support for this in order to allow me to run a corpus of existing queries which depend on this syntax.
> There's a good writeup on this at http://modern-sql.com/feature/table-column-aliases, which has additional examples and describes other databases' degrees of support for this feature.
> One tricky thing to figure out will be whether FROM clause column aliases take precedence over aliases in the SELECT clause. When adding support for this, we should make sure to add sufficient testing of several corner-cases, including:
> * Aliasing in both the SELECT and FROM clause
> * Aliasing columns in the FROM clause both with and without an explicit AS.
> * Aliasing the wrong number of columns in the FROM clause, both greater and fewer columns than were selected in the SELECT clause.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org