[GitHub] spark pull request: [SPARK-13732] [SPARK-13797] [SPARK-13798] [SQL...

2016-03-09 Thread cloud-fan
Github user cloud-fan commented on a diff in the pull request:

https://github.com/apache/spark/pull/11565#discussion_r55642440
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
@@ -384,9 +374,25 @@ object ColumnPruning extends Rule[LogicalPlan] {
 // Eliminate no-op Projects
 case p @ Project(projectList, child) if sameOutput(child.output, 
p.output) => child
 
+// Eliminate no-op Window
+case w: Window if sameOutput(w.child.output, w.output) => w.child
+
+// Convert Aggregate to Project if no aggregate function exists
+case a: Aggregate if !containsAggregates(a.expressions) =>
+  Project(a.aggregateExpressions, a.child)
--- End diff --

I mean, `select a from t group by a` is totally different than `select a 
from t`


---
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: [SPARK-13732] [SPARK-13797] [SPARK-13798] [SQL...

2016-03-09 Thread gatorsmile
Github user gatorsmile commented on a diff in the pull request:

https://github.com/apache/spark/pull/11565#discussion_r55642460
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
@@ -384,9 +374,25 @@ object ColumnPruning extends Rule[LogicalPlan] {
 // Eliminate no-op Projects
 case p @ Project(projectList, child) if sameOutput(child.output, 
p.output) => child
 
+// Eliminate no-op Window
+case w: Window if sameOutput(w.child.output, w.output) => w.child
+
+// Convert Aggregate to Project if no aggregate function exists
+case a: Aggregate if !containsAggregates(a.expressions) =>
+  Project(a.aggregateExpressions, a.child)
--- End diff --

Yeah, I forgot it... 


---
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: [SPARK-13732] [SPARK-13797] [SPARK-13798] [SQL...

2016-03-09 Thread cloud-fan
Github user cloud-fan commented on a diff in the pull request:

https://github.com/apache/spark/pull/11565#discussion_r55642323
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
@@ -384,9 +374,25 @@ object ColumnPruning extends Rule[LogicalPlan] {
 // Eliminate no-op Projects
 case p @ Project(projectList, child) if sameOutput(child.output, 
p.output) => child
 
+// Eliminate no-op Window
+case w: Window if sameOutput(w.child.output, w.output) => w.child
+
+// Convert Aggregate to Project if no aggregate function exists
+case a: Aggregate if !containsAggregates(a.expressions) =>
+  Project(a.aggregateExpressions, a.child)
--- End diff --

But `Aggregate` will do grouping, even there is no aggregate expressions, I 
think this is not right.


---
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: [SPARK-13732] [SPARK-13797] [SPARK-13798] [SQL...

2016-03-09 Thread gatorsmile
Github user gatorsmile commented on a diff in the pull request:

https://github.com/apache/spark/pull/11565#discussion_r55642338
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
@@ -384,9 +374,25 @@ object ColumnPruning extends Rule[LogicalPlan] {
 // Eliminate no-op Projects
 case p @ Project(projectList, child) if sameOutput(child.output, 
p.output) => child
 
+// Eliminate no-op Window
+case w: Window if sameOutput(w.child.output, w.output) => w.child
--- End diff --

yeah, will do


---
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: [SPARK-13732] [SPARK-13797] [SPARK-13798] [SQL...

2016-03-09 Thread cloud-fan
Github user cloud-fan commented on a diff in the pull request:

https://github.com/apache/spark/pull/11565#discussion_r55642207
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
@@ -384,9 +374,25 @@ object ColumnPruning extends Rule[LogicalPlan] {
 // Eliminate no-op Projects
 case p @ Project(projectList, child) if sameOutput(child.output, 
p.output) => child
 
+// Eliminate no-op Window
+case w: Window if sameOutput(w.child.output, w.output) => w.child
--- End diff --

`w.windowExpressions.empty` looks simplier?


---
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: [SPARK-13732] [SPARK-13797] [SPARK-13798] [SQL...

2016-03-09 Thread gatorsmile
Github user gatorsmile commented on the pull request:

https://github.com/apache/spark/pull/11565#issuecomment-194713298
  
In the latest PR: we added two more cases/rules into the Optimizer. 

- After column pruning, if `Window` could contain an empty 
`windowExpressions` list, we can remove it
- After column pruning, if `Aggregate` does not contain any 
`AggregateExpression`, we can replace it by `Project`. Then, `Project` can be 
collapsed or pushed down further.


---
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: [SPARK-13732] [SPARK-13797] [SPARK-13798] [SQL...

2016-03-09 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/11565#issuecomment-194709320
  
**[Test build #52818 has 
started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/52818/consoleFull)**
 for PR 11565 at commit 
[`6cf6f44`](https://github.com/apache/spark/commit/6cf6f444697c0bc32dbc09906fe144563a7d66df).


---
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