You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2016/04/27 01:24:12 UTC

[jira] [Created] (SPARK-14939) Eliminate No-op Alias SortOrder in Sort

Dongjoon Hyun created SPARK-14939:
-------------------------------------

             Summary: 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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org