[GitHub] spark pull request #13905: [SPARK-16208][SQL] Add `CollapseEmptyPlan` optimi...

2016-06-25 Thread dongjoon-hyun
Github user dongjoon-hyun closed the pull request at:

https://github.com/apache/spark/pull/13905


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #13905: [SPARK-16208][SQL] Add `CollapseEmptyPlan` optimi...

2016-06-25 Thread dongjoon-hyun
GitHub user dongjoon-hyun opened a pull request:

https://github.com/apache/spark/pull/13905

[SPARK-16208][SQL] Add `CollapseEmptyPlan` optimizer

## What changes were proposed in this pull request?

This PR adds a new logical optimizer, `CollapseEmptyPlan`, to collapse a 
logical plain consisting of only empty LocalRelations.

**Before**
```scala
scala> sql("select a from (select explode(array(1,2,3)) a) where 1=0 group 
by a having count(*)>1 order by a").explain
== Physical Plan ==
*Sort [a#15 ASC], true, 0
+- Exchange rangepartitioning(a#15 ASC, 200)
   +- *Project [a#15]
  +- *Filter (count(1)#17L > 1)
 +- *HashAggregate(keys=[a#15], functions=[count(1)])
+- Exchange hashpartitioning(a#15, 200)
   +- *HashAggregate(keys=[a#15], functions=[partial_count(1)])
  +- Generate explode([1,2,3]), false, false, [a#15]
 +- LocalTableScan 
```

**After**
```scala
scala> sql("select a from (select explode(array(1,2,3)) a) where 1=0 group 
by a having count(*)>1 order by a").explain
== Physical Plan ==
LocalTableScan , [a#15]
```

## How was this patch tested?

Pass the Jenkins tests (including a new testsuite).

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/dongjoon-hyun/spark SPARK-16208

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/13905.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #13905


commit db0aeb9fa9a38b1deb44399f434b1e549a79be6e
Author: Dongjoon Hyun 
Date:   2016-06-25T09:18:44Z

[SPARK-16208][SQL] Add `CollapseEmptyPlan` optimizer




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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