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

Wenchen Fan resolved SPARK-16374.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.1.0

Issue resolved by pull request 14053
[https://github.com/apache/spark/pull/14053]

> Remove Alias from MetastoreRelation and SimpleCatalogRelation
> -------------------------------------------------------------
>
>                 Key: SPARK-16374
>                 URL: https://issues.apache.org/jira/browse/SPARK-16374
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.0.0
>            Reporter: Xiao Li
>            Assignee: Xiao Li
>             Fix For: 2.1.0
>
>
> Different from the other leaf nodes, `MetastoreRelation` and 
> `SimpleCatalogRelation` have a pre-defined `alias`, which is used to change 
> the qualifier of the node. However, based on the existing alias handling, 
> alias should be put in `SubqueryAlias`. 
> This PR is to separate alias handling from `MetastoreRelation` and 
> `SimpleCatalogRelation` to make it consistent with the other nodes. 
> For example, below is an example query for `MetastoreRelation`, which is 
> converted to `LogicalRelation`:
> {noformat}
> SELECT tmp.a + 1 FROM test_parquet_ctas tmp WHERE tmp.a > 2
> {noformat}
> Before changes, the analyzed plan is
> {noformat}
> == Analyzed Logical Plan ==
> (a + 1): int
> Project [(a#951 + 1) AS (a + 1)#952]
> +- Filter (a#951 > 2)
>    +- SubqueryAlias tmp
>       +- Relation[a#951] parquet
> {noformat}
> After changes, the analyzed plan becomes
> {noformat}
> == Analyzed Logical Plan ==
> (a + 1): int
> Project [(a#951 + 1) AS (a + 1)#952]
> +- Filter (a#951 > 2)
>    +- SubqueryAlias tmp
>       +- SubqueryAlias test_parquet_ctas
>          +- Relation[a#951] parquet
> {noformat}
> **Note: the optimized plans are the same.**
> For `SimpleCatalogRelation`, the existing code always generates two 
> Subqueries. Thus, no change is needed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to