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

Dongjoon Hyun reopened SPARK-16208:
-----------------------------------

I made a new PR.

> Add `CollapseEmptyPlan` optimizer
> ---------------------------------
>
>                 Key: SPARK-16208
>                 URL: https://issues.apache.org/jira/browse/SPARK-16208
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Dongjoon Hyun
>            Assignee: Apache Spark
>            Priority: Minor
>
> This PR adds a new logical optimizer, `CollapseEmptyPlan`, to collapse a 
> logical plans consisting of only empty LocalRelations. The only exceptional 
> logical plan is aggregation. For aggregation plan, only simple cases are 
> consider for this optimization.
> **Before**
> {code}
> scala> sql("select a from values (1,2) T(a,b) where 1=0 group by a,b having 
> a>1 order by a,b").explain
> == Physical Plan ==
> *Project [a#11]
> +- *Sort [a#11 ASC, b#12 ASC], true, 0
>    +- Exchange rangepartitioning(a#11 ASC, b#12 ASC, 200)
>       +- *HashAggregate(keys=[a#11, b#12], functions=[])
>          +- Exchange hashpartitioning(a#11, b#12, 200)
>             +- *HashAggregate(keys=[a#11, b#12], functions=[])
>                +- LocalTableScan <empty>, [a#11, b#12]
> {code}
> **After**
> {code}
> scala> sql("select a from values (1,2) T(a,b) where 1=0 group by a,b having 
> a>1 order by a,b").explain
> == Physical Plan ==
> LocalTableScan <empty>, [a#0]
> {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