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

Apache Spark commented on SPARK-14939:
--------------------------------------

User 'dongjoon-hyun' has created a pull request for this issue:
https://github.com/apache/spark/pull/12719

> Eliminate No-op Alias SortOrder in Sort
> ---------------------------------------
>
>                 Key: SPARK-14939
>                 URL: https://issues.apache.org/jira/browse/SPARK-14939
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Dongjoon Hyun
>
> This issue aims to delete No-op **Alias** SortOrders in Sort. Currently, 
> `EliminateSorts` removes direct foldable expressions, but cannot handle 
> aliases.
> **Before**
> {code}
> scala> sql("select a, year(current_date()) as y from (select 
> explode(array(1,2)) a) order by y").explain()
> == Physical Plan ==
> WholeStageCodegen
> :  +- Sort [y#8 ASC], true, 0
> :     +- INPUT
> +- Exchange rangepartitioning(y#8 ASC, 200), None
>    +- WholeStageCodegen
>       :  +- Project [a#13,2016 AS y#8]
>       :     +- INPUT
>       +- Generate explode([1,2]), false, false, [a#13]
>          +- Scan OneRowRelation[]
> {code}
> **After**
> {code}
> scala> sql("select a, year(current_date()) as y from (select 
> explode(array(1,2)) a) order by y").explain()
> == Physical Plan ==
> WholeStageCodegen
> :  +- Project [a#13,2016 AS y#8]
> :     +- INPUT
> +- Generate explode([1,2]), false, false, [a#13]
>    +- Scan OneRowRelation[]
> {code}



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

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

Reply via email to