[ 
https://issues.apache.org/jira/browse/SPARK-19598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15867548#comment-15867548
 ] 

Song Jun edited comment on SPARK-19598 at 2/15/17 9:46 AM:
-----------------------------------------------------------

[~rxin] When I do this jira, I found it that it is not proper to remove 
UnresolvedRelation's alias argument. If we remove it and use SubqueryAlias, 
that is:

{quote}SubqueryAlias(alias,UnresolvedRelation(tableIdentifier),None){quote}

to replace 

{quote}UnresolvedRelation(tableIdentifier, alias){quote}

While there are lots of  *match case* codes for *UnresolvedRelation*,  and in 
matched logic it will use the alias parameter of *UnresolvedRelation*, 
currently table with/without alias can processed in one *match case 
UnresolvedRelation* logic, after this change, we should process table with 
alias and without alias seperately in two *match case*:
{quote}
case u:UnresolvedRelation => func(u,None)
case s@SubqueryAlias(alias,u:UnresolvedRelation,_) => func(u, alias)
{quote}
 
such as:
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L589-L591

https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L626

Is this right? Or am I missing something?


was (Author: windpiger):
[~rxin] When I do this jira, I found it that it is not proper to remove 
UnresolvedRelation's alias argument. If we remove it and use SubqueryAlias, 
that is:

{quote}SubqueryAlias(alias,UnresolvedRelation(tableIdentifier),None){quote}

to replace 

{quote}UnresolvedRelation(tableIdentifier, aliase){quote}

While there are lots of  *match case* codes for *UnresolvedRelation*,  and in 
matched logic it will use the alias parameter of *UnresolvedRelation*, 
currently table with/without alias can processed in one *match case 
UnresolvedRelation* logic, after this change, we should process table with 
alias and without alias seperately in two *match case*:
{quote}
case u:UnresolvedRelation => func(u,None)
case s@SubqueryAlias(alias,u:UnresolvedRelation,_) => func(u, alias)
{quote}
 
such as:
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L589-L591

https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L626

Is this right? Or am I missing something?

> Remove the alias parameter in UnresolvedRelation
> ------------------------------------------------
>
>                 Key: SPARK-19598
>                 URL: https://issues.apache.org/jira/browse/SPARK-19598
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.2.0
>            Reporter: Reynold Xin
>
> UnresolvedRelation has a second argument named "alias", for assigning the 
> relation an alias. I think we can actually remove it and replace its use with 
> a SubqueryAlias.
> This would actually simplify some analyzer code to only match on 
> SubqueryAlias. For example, the broadcast hint pull request can have one 
> fewer case https://github.com/apache/spark/pull/16925/files.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to