You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/08/05 04:59:16 UTC
[GitHub] [spark] allisonwang-db opened a new pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
allisonwang-db opened a new pull request #29031:
URL: https://github.com/apache/spark/pull/29031
### What changes were proposed in this pull request?
This PR added a physical rule to remove redundant project nodes. A `ProjectExec` is redundant when
1. It has the same output attributes and order as its child's output when ordering of these attributes is required.
2. It has the same output attributes as its child's output when attribute output ordering is not required.
For example:
After Filter:
```
== Physical Plan ==
*(1) Project [a#14L, b#15L, c#16, key#17]
+- *(1) Filter (isnotnull(a#14L) AND (a#14L > 5))
+- *(1) ColumnarToRow
+- FileScan parquet [a#14L,b#15L,c#16,key#17]
```
The `Project a#14L, b#15L, c#16, key#17` is redundant because its output is exactly the same as filter's output.
Before Aggregate:
```
== Physical Plan ==
*(2) HashAggregate(keys=[key#17], functions=[sum(a#14L), last(b#15L, false)], output=[sum_a#39L, key#17, last_b#41L])
+- Exchange hashpartitioning(key#17, 5), true, [id=#77]
+- *(1) HashAggregate(keys=[key#17], functions=[partial_sum(a#14L), partial_last(b#15L, false)], output=[key#17, sum#49L, last#50L, valueSet#51])
+- *(1) Project [key#17, a#14L, b#15L]
+- *(1) Filter (isnotnull(a#14L) AND (a#14L > 100))
+- *(1) ColumnarToRow
+- FileScan parquet [a#14L,b#15L,key#17]
```
The `Project key#17, a#14L, b#15L` is redundant because hash aggregate doesn't require child plan's output to be in a specific order.
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
It removes unnecessary query nodes and makes query plan cleaner.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
No
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
Unit tests
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670052213
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r452032993
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/RemoveRedundantProjectsSuite.scala
##########
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.{DataFrame, QueryTest}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.SharedSparkSession
+
+class RemoveRedundantProjectsSuite extends QueryTest with SharedSparkSession {
+
+ private def assertProjectExecCount(df: DataFrame, expected: Integer): Unit = {
+ withClue(df.queryExecution) {
+ val plan = df.queryExecution.executedPlan
+ val actual = plan.collectWithSubqueries { case p: ProjectExec => p }.size
+ assert(actual == expected)
+ }
+ }
+
+ private def assertProjectExec(query: String, enabled: Integer, disabled: Integer): Unit = {
+ val df = sql(query)
+ assertProjectExecCount(df, enabled)
+ val result1 = df.collect()
+ withSQLConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED.key -> "false") {
+ val df2 = sql(query)
+ assertProjectExecCount(df2, disabled)
+ QueryTest.sameRows(result1.toSeq, df2.collect().toSeq)
+ }
+ }
+
+ private def withTestView(f: => Unit): Unit = {
+ withTempPath { p =>
+ val path = p.getAbsolutePath
+ spark.range(100).selectExpr("id % 10 as key", "id * 2 as a",
+ "id * 3 as b", "cast(id as string) as c", "array(id, id + 1, id + 3) as d")
+ .write.partitionBy("key").parquet(path)
+ spark.read.parquet(path).createOrReplaceTempView("testView")
+ f
+ }
+ }
+
+ test("project") {
+ withTestView {
+ val query = "select * from testView"
+ assertProjectExec(query, 0, 0)
+ }
+ }
+
+ test("project with filter") {
+ withTestView {
+ val query = "select * from testView where a > 5"
+ assertProjectExec(query, 0, 1)
+ }
+ }
+
+ test("project with specific column ordering") {
+ withTestView {
+ val query = "select key, a, b, c from testView"
+ assertProjectExec(query, 1, 1)
+ }
+ }
+
+ test("project with extra columns") {
+ withTestView {
+ val query = "select a, b, c, key, a from testView"
+ assertProjectExec(query, 1, 1)
+ }
+ }
+
+ test("project with fewer columns") {
+ withTestView {
+ val query = "select a from testView where a > 3"
+ assertProjectExec(query, 1, 1)
+ }
+ }
+
+ test("aggregate without ordering requirement") {
+ withTestView {
+ val query = "select sum(a) as sum_a, key, last(b) as last_b " +
+ "from (select key, a, b from testView where a > 100) group by key"
+ assertProjectExec(query, 0, 1)
+ }
+ }
+
+ test("aggregate with ordering requirement") {
+ withTestView {
+ val query = "select a, sum(b) as sum_b from testView group by a"
+ assertProjectExec(query, 1, 1)
+ }
+ }
+
+ test("join without ordering requirement") {
+ withTestView {
+ val query = "select t1.key, t2.key, t1.a, t2.b from (select key, a, b, c from testView)" +
+ " as t1 join (select key, a, b, c from testView) as t2 on t1.c > t2.c and t1.key > 10"
+ assertProjectExec(query, 1, 3)
+ }
+ }
+
+ test("join with ordering requirement") {
+ withTestView {
+ val query = "select * from (select key, a, c, b from testView) as t1 join " +
+ "(select key, a, b, c from testView) as t2 on t1.key = t2.key where t2.a > 50"
+ assertProjectExec(query, 2, 2)
+ }
+ }
+
+ test("window function") {
+ withTestView {
+ val query = "select key, avg(a) over (partition by key order by a " +
+ "rows between 1 preceding and 1 following) as avg, b from testView"
+ assertProjectExec(query, 1, 2)
+ }
+ }
+
+ test("generate") {
+ withTestView {
+ val query = "select a, key, explode(d) from testView where a > 10"
+ assertProjectExec(query, 0, 1)
+ }
+ }
+
+ test("subquery") {
Review comment:
can we add one more test to apply this optimization inside subqueries?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670052213
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670189685
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656521488
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/125546/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan closed pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #29031:
URL: https://github.com/apache/spark/pull/29031
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655915736
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668981428
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655968416
**[Test build #125453 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125453/testReport)** for PR 29031 at commit [`a24d93f`](https://github.com/apache/spark/commit/a24d93feaa14f01e7878df1a8b2557ec26ea6104).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r451267070
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -1224,6 +1224,15 @@ object SQLConf {
.booleanConf
.createWithDefault(true)
+ val REMOVE_REDUNDANT_PROJECTS_ENABLED =
+ buildConf("spark.sql.execution.removeRedundantProjects")
+ .internal()
+ .doc("Whether to remove redundant project exec node based on children's output and " +
+ "ordering requirement.")
+ .version("3.0.0")
Review comment:
-> 3.1.0
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656455523
**[Test build #125546 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125546/testReport)** for PR 29031 at commit [`2613c30`](https://github.com/apache/spark/commit/2613c3081f2dfe72bf6b12ccfe16c7e7b81aa40a).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-669015315
**[Test build #127077 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127077/testReport)** for PR 29031 at commit [`4585a04`](https://github.com/apache/spark/commit/4585a04ef4548022865ea0978040d9dd56df8252).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-669015424
Merged build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670051426
**[Test build #127150 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127150/testReport)** for PR 29031 at commit [`abca971`](https://github.com/apache/spark/commit/abca97120db8e6cea71446b9e5e93db08f493e34).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656520170
**[Test build #125546 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125546/testReport)** for PR 29031 at commit [`2613c30`](https://github.com/apache/spark/commit/2613c3081f2dfe72bf6b12ccfe16c7e7b81aa40a).
* This patch **fails due to an unknown error code, -9**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670350252
**[Test build #127163 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127163/testReport)** for PR 29031 at commit [`6d5cade`](https://github.com/apache/spark/commit/6d5cadec111cfe64f55d79a1cc95873830267a16).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656455718
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668981428
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655968416
**[Test build #125453 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125453/testReport)** for PR 29031 at commit [`a24d93f`](https://github.com/apache/spark/commit/a24d93feaa14f01e7878df1a8b2557ec26ea6104).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671579594
**[Test build #127289 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127289/testReport)** for PR 29031 at commit [`8495025`](https://github.com/apache/spark/commit/84950256be633777ff461919b93b2e73bec2d899).
* This patch passes all tests.
* This patch **does not merge cleanly**.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670308413
**[Test build #127159 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127159/testReport)** for PR 29031 at commit [`6d5cade`](https://github.com/apache/spark/commit/6d5cadec111cfe64f55d79a1cc95873830267a16).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670237403
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/127155/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671488413
can you rebase/merge with the master branch to fix conflicts?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668365535
Merged build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668365539
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/127019/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670772420
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r452665088
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -1224,6 +1224,15 @@ object SQLConf {
.booleanConf
.createWithDefault(true)
+ val REMOVE_REDUNDANT_PROJECTS_ENABLED =
+ buildConf("spark.sql.execution.removeRedundantProjects")
+ .internal()
Review comment:
nit: indentation is wrong
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655965142
retest this please
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655969079
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656521479
Merged build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670276032
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670237030
**[Test build #127155 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127155/testReport)** for PR 29031 at commit [`1632028`](https://github.com/apache/spark/commit/1632028d2ac54e8bbb3970f81f0c6f3f8eacb32f).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670275716
**[Test build #127163 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127163/testReport)** for PR 29031 at commit [`6d5cade`](https://github.com/apache/spark/commit/6d5cadec111cfe64f55d79a1cc95873830267a16).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655942958
Merged build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] allisonwang-db commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
allisonwang-db commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r452583080
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/RemoveRedundantProjects.scala
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.catalyst.expressions.aggregate.{Final, PartialMerge}
+import org.apache.spark.sql.catalyst.rules.Rule
+import org.apache.spark.sql.execution.aggregate.BaseAggregateExec
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2ScanExecBase
+import org.apache.spark.sql.execution.window.WindowExec
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * Remove redundant ProjectExec node from the spark plan. A ProjectExec node is redundant when
+ * - It has the same output attributes and orders as its child's output and the ordering of
+ * the attributes is required.
+ * - It has the same output attributes as its child's output when attribute output ordering
+ * is not required.
+ * This rule needs to be a physical rule because project nodes are useful during logical
+ * optimization to prune data. During physical planning, redundant project nodes can be removed
+ * to simplify the query plan.
+ */
+case class RemoveRedundantProjects(conf: SQLConf) extends Rule[SparkPlan] {
+ def apply(plan: SparkPlan): SparkPlan = {
+ if (!conf.getConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED)) {
+ plan
+ } else {
+ removeProject(plan, true)
+ }
+ }
+
+ private def removeProject(plan: SparkPlan, requireOrdering: Boolean): SparkPlan = {
+ plan match {
+ case p @ ProjectExec(_, child) =>
+ if (isRedundant(p, child, requireOrdering)) {
+ val newPlan = removeProject(child, requireOrdering)
+ newPlan.setLogicalLink(child.logicalLink.get)
+ newPlan
+ } else {
+ p.mapChildren(removeProject(_, false))
+ }
+ case op: TakeOrderedAndProjectExec =>
+ op.mapChildren(removeProject(_, false))
+ case a: BaseAggregateExec =>
+ // BaseAggregateExec require specific column ordering when mode is Final or PartialMerge.
+ // See comments in BaseAggregateExec inputAttributes method.
+ val keepOrdering = a.aggregateExpressions
+ .exists(ae => ae.mode.equals(Final) || ae.mode.equals(PartialMerge))
+ a.mapChildren(removeProject(_, keepOrdering))
+ case w: WindowExec => w.mapChildren(removeProject(_, false))
Review comment:
Instead of setting require ordering to be true, I am wondering should `WindowExec` inherit this ordering requirement from its parent? For example in this case
```
Project[a, avg, key]
WindowExec[avg] [key] [a]
```
`WindowExec` actually does't require column to be ordered. Is there any scenario where `WindowExec` must require child output column to be ordered? I am having trouble coming up with a test case for it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-669015435
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/127077/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668357156
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655942972
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/125436/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-669052531
seems this breaks the DPP test, @allisonwang-db please take a look.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656072236
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655915736
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655198271
Can one of the admins verify this patch?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655915346
**[Test build #125436 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125436/testReport)** for PR 29031 at commit [`a24d93f`](https://github.com/apache/spark/commit/a24d93feaa14f01e7878df1a8b2557ec26ea6104).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655197943
Can one of the admins verify this patch?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655969079
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670772420
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670309030
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668980317
add to whitelist
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670157599
**[Test build #127150 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127150/testReport)** for PR 29031 at commit [`abca971`](https://github.com/apache/spark/commit/abca97120db8e6cea71446b9e5e93db08f493e34).
* This patch **fails PySpark pip packaging tests**.
* This patch **does not merge cleanly**.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668981110
**[Test build #127077 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127077/testReport)** for PR 29031 at commit [`4585a04`](https://github.com/apache/spark/commit/4585a04ef4548022865ea0978040d9dd56df8252).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656455523
**[Test build #125546 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125546/testReport)** for PR 29031 at commit [`2613c30`](https://github.com/apache/spark/commit/2613c3081f2dfe72bf6b12ccfe16c7e7b81aa40a).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r452666532
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/RemoveRedundantProjectsSuite.scala
##########
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.{DataFrame, QueryTest}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
+import org.apache.spark.util.Utils
+
+class RemoveRedundantProjectsSuite extends QueryTest with SharedSparkSession with SQLTestUtils {
+
+ private def assertProjectExecCount(df: DataFrame, expected: Integer): Unit = {
+ withClue(df.queryExecution) {
+ val plan = df.queryExecution.executedPlan
+ val actual = plan.collectWithSubqueries { case p: ProjectExec => p }.size
+ assert(actual == expected)
+ }
+ }
+
+ private def assertProjectExec(query: String, enabled: Integer, disabled: Integer): Unit = {
+ val df = sql(query)
+ assertProjectExecCount(df, enabled)
+ val result = df.collect()
+ withSQLConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED.key -> "false") {
+ val df2 = sql(query)
+ assertProjectExecCount(df2, disabled)
+ checkAnswer(df2, result)
+ }
+ }
+
+ private val tmpPath = Utils.createTempDir()
+
+ override def beforeAll(): Unit = {
+ super.beforeAll()
+ tmpPath.delete()
+ val path = tmpPath.getAbsolutePath
+ spark.range(100).selectExpr("id % 10 as key", "cast(id * 2 as int) as a",
+ "cast(id * 3 as int) as b", "cast(id as string) as c", "array(id, id + 1, id + 3) as d")
+ .write.partitionBy("key").parquet(path)
+ spark.read.parquet(path).createOrReplaceTempView("testView")
+ }
+
+ override def afterAll(): Unit = {
+ Utils.deleteRecursively(tmpPath)
+ super.afterAll()
+ }
+
+ test("project") {
+ val query = "select * from testView"
+ assertProjectExec(query, 0, 0)
+ }
+
+ test("project with filter") {
+ val query = "select * from testView where a > 5"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("project with specific column ordering") {
+ val query = "select key, a, b, c from testView"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("project with extra columns") {
+ val query = "select a, b, c, key, a from testView"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("project with fewer columns") {
+ val query = "select a from testView where a > 3"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("aggregate without ordering requirement") {
+ val query = "select sum(a) as sum_a, key, last(b) as last_b " +
+ "from (select key, a, b from testView where a > 100) group by key"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("aggregate with ordering requirement") {
+ val query = "select a, sum(b) as sum_b from testView group by a"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("join without ordering requirement") {
+ val query = "select t1.key, t2.key, t1.a, t2.b from (select key, a, b, c from testView)" +
+ " as t1 join (select key, a, b, c from testView) as t2 on t1.c > t2.c and t1.key > 10"
+ assertProjectExec(query, 1, 3)
+ }
+
+ test("join with ordering requirement") {
+ val query = "select * from (select key, a, c, b from testView) as t1 join " +
+ "(select key, a, b, c from testView) as t2 on t1.key = t2.key where t2.a > 50"
+ assertProjectExec(query, 2, 2)
+ }
+
+ test("window function") {
+ val query = "select key, b, avg(a) over (partition by key order by a " +
+ "rows between 1 preceding and 1 following) as avg from testView"
+ assertProjectExec(query, 1, 2)
+ }
+
+ test("generate") {
+ val query = "select a, key, explode(d) from testView where a > 10"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("subquery") {
+ testData
Review comment:
remove this line?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670158506
Build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670242001
**[Test build #127159 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127159/testReport)** for PR 29031 at commit [`6d5cade`](https://github.com/apache/spark/commit/6d5cadec111cfe64f55d79a1cc95873830267a16).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656072236
Merged build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668365535
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r452666212
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/RemoveRedundantProjectsSuite.scala
##########
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.{DataFrame, QueryTest}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
+import org.apache.spark.util.Utils
+
+class RemoveRedundantProjectsSuite extends QueryTest with SharedSparkSession with SQLTestUtils {
+
+ private def assertProjectExecCount(df: DataFrame, expected: Integer): Unit = {
+ withClue(df.queryExecution) {
+ val plan = df.queryExecution.executedPlan
+ val actual = plan.collectWithSubqueries { case p: ProjectExec => p }.size
+ assert(actual == expected)
+ }
+ }
+
+ private def assertProjectExec(query: String, enabled: Integer, disabled: Integer): Unit = {
Review comment:
`Integer` -> `Int`?
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/RemoveRedundantProjectsSuite.scala
##########
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.{DataFrame, QueryTest}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
+import org.apache.spark.util.Utils
+
+class RemoveRedundantProjectsSuite extends QueryTest with SharedSparkSession with SQLTestUtils {
+
+ private def assertProjectExecCount(df: DataFrame, expected: Integer): Unit = {
Review comment:
ditto
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] allisonwang-db commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
allisonwang-db commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668724853
retest this please
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] allisonwang-db commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
allisonwang-db commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r464723488
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/RemoveRedundantProjectsSuite.scala
##########
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.{DataFrame, QueryTest}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
+import org.apache.spark.util.Utils
+
+class RemoveRedundantProjectsSuite extends QueryTest with SharedSparkSession with SQLTestUtils {
+
+ private def assertProjectExecCount(df: DataFrame, expected: Integer): Unit = {
+ withClue(df.queryExecution) {
+ val plan = df.queryExecution.executedPlan
+ val actual = plan.collectWithSubqueries { case p: ProjectExec => p }.size
+ assert(actual == expected)
+ }
+ }
+
+ private def assertProjectExec(query: String, enabled: Integer, disabled: Integer): Unit = {
+ val df = sql(query)
+ assertProjectExecCount(df, enabled)
+ val result = df.collect()
+ withSQLConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED.key -> "false") {
+ val df2 = sql(query)
+ assertProjectExecCount(df2, disabled)
+ checkAnswer(df2, result)
+ }
+ }
+
+ private val tmpPath = Utils.createTempDir()
+
+ override def beforeAll(): Unit = {
+ super.beforeAll()
+ tmpPath.delete()
+ val path = tmpPath.getAbsolutePath
+ spark.range(100).selectExpr("id % 10 as key", "cast(id * 2 as int) as a",
+ "cast(id * 3 as int) as b", "cast(id as string) as c", "array(id, id + 1, id + 3) as d")
+ .write.partitionBy("key").parquet(path)
+ spark.read.parquet(path).createOrReplaceTempView("testView")
+ }
+
+ override def afterAll(): Unit = {
+ Utils.deleteRecursively(tmpPath)
+ super.afterAll()
+ }
+
+ test("project") {
+ val query = "select * from testView"
+ assertProjectExec(query, 0, 0)
+ }
+
+ test("project with filter") {
+ val query = "select * from testView where a > 5"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("project with specific column ordering") {
+ val query = "select key, a, b, c from testView"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("project with extra columns") {
+ val query = "select a, b, c, key, a from testView"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("project with fewer columns") {
+ val query = "select a from testView where a > 3"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("aggregate without ordering requirement") {
+ val query = "select sum(a) as sum_a, key, last(b) as last_b " +
+ "from (select key, a, b from testView where a > 100) group by key"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("aggregate with ordering requirement") {
+ val query = "select a, sum(b) as sum_b from testView group by a"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("join without ordering requirement") {
+ val query = "select t1.key, t2.key, t1.a, t2.b from (select key, a, b, c from testView)" +
+ " as t1 join (select key, a, b, c from testView) as t2 on t1.c > t2.c and t1.key > 10"
+ assertProjectExec(query, 1, 3)
+ }
+
+ test("join with ordering requirement") {
+ val query = "select * from (select key, a, c, b from testView) as t1 join " +
+ "(select key, a, b, c from testView) as t2 on t1.key = t2.key where t2.a > 50"
+ assertProjectExec(query, 2, 2)
+ }
+
+ test("window function") {
+ val query = "select key, b, avg(a) over (partition by key order by a " +
+ "rows between 1 preceding and 1 following) as avg from testView"
+ assertProjectExec(query, 1, 2)
+ }
+
+ test("generate") {
+ val query = "select a, key, explode(d) from testView where a > 10"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("subquery") {
+ testData
Review comment:
@cloud-fan The reason why I am using testData here is that the view test view here can't have extra `Project', but using normal DataFrame creation method it will always create a new `Project` to map their names. So I just reused this test data. Is there a way to create DataFrame without introducing new Projects?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671504497
**[Test build #127290 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127290/testReport)** for PR 29031 at commit [`394126d`](https://github.com/apache/spark/commit/394126da654c15c59a58bd906f0ca4564ce1c4e5).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671580796
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655942845
**[Test build #125436 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125436/testReport)** for PR 29031 at commit [`a24d93f`](https://github.com/apache/spark/commit/a24d93feaa14f01e7878df1a8b2557ec26ea6104).
* This patch **fails due to an unknown error code, -9**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670189685
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670158506
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670158519
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/127150/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670771944
**[Test build #127212 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127212/testReport)** for PR 29031 at commit [`feabc1f`](https://github.com/apache/spark/commit/feabc1fb0406c739602ee0683bdd03e29dc7ea71).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670242001
**[Test build #127159 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127159/testReport)** for PR 29031 at commit [`6d5cade`](https://github.com/apache/spark/commit/6d5cadec111cfe64f55d79a1cc95873830267a16).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656455718
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] allisonwang-db commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
allisonwang-db commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r464723488
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/RemoveRedundantProjectsSuite.scala
##########
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.{DataFrame, QueryTest}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
+import org.apache.spark.util.Utils
+
+class RemoveRedundantProjectsSuite extends QueryTest with SharedSparkSession with SQLTestUtils {
+
+ private def assertProjectExecCount(df: DataFrame, expected: Integer): Unit = {
+ withClue(df.queryExecution) {
+ val plan = df.queryExecution.executedPlan
+ val actual = plan.collectWithSubqueries { case p: ProjectExec => p }.size
+ assert(actual == expected)
+ }
+ }
+
+ private def assertProjectExec(query: String, enabled: Integer, disabled: Integer): Unit = {
+ val df = sql(query)
+ assertProjectExecCount(df, enabled)
+ val result = df.collect()
+ withSQLConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED.key -> "false") {
+ val df2 = sql(query)
+ assertProjectExecCount(df2, disabled)
+ checkAnswer(df2, result)
+ }
+ }
+
+ private val tmpPath = Utils.createTempDir()
+
+ override def beforeAll(): Unit = {
+ super.beforeAll()
+ tmpPath.delete()
+ val path = tmpPath.getAbsolutePath
+ spark.range(100).selectExpr("id % 10 as key", "cast(id * 2 as int) as a",
+ "cast(id * 3 as int) as b", "cast(id as string) as c", "array(id, id + 1, id + 3) as d")
+ .write.partitionBy("key").parquet(path)
+ spark.read.parquet(path).createOrReplaceTempView("testView")
+ }
+
+ override def afterAll(): Unit = {
+ Utils.deleteRecursively(tmpPath)
+ super.afterAll()
+ }
+
+ test("project") {
+ val query = "select * from testView"
+ assertProjectExec(query, 0, 0)
+ }
+
+ test("project with filter") {
+ val query = "select * from testView where a > 5"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("project with specific column ordering") {
+ val query = "select key, a, b, c from testView"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("project with extra columns") {
+ val query = "select a, b, c, key, a from testView"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("project with fewer columns") {
+ val query = "select a from testView where a > 3"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("aggregate without ordering requirement") {
+ val query = "select sum(a) as sum_a, key, last(b) as last_b " +
+ "from (select key, a, b from testView where a > 100) group by key"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("aggregate with ordering requirement") {
+ val query = "select a, sum(b) as sum_b from testView group by a"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("join without ordering requirement") {
+ val query = "select t1.key, t2.key, t1.a, t2.b from (select key, a, b, c from testView)" +
+ " as t1 join (select key, a, b, c from testView) as t2 on t1.c > t2.c and t1.key > 10"
+ assertProjectExec(query, 1, 3)
+ }
+
+ test("join with ordering requirement") {
+ val query = "select * from (select key, a, c, b from testView) as t1 join " +
+ "(select key, a, b, c from testView) as t2 on t1.key = t2.key where t2.a > 50"
+ assertProjectExec(query, 2, 2)
+ }
+
+ test("window function") {
+ val query = "select key, b, avg(a) over (partition by key order by a " +
+ "rows between 1 preceding and 1 following) as avg from testView"
+ assertProjectExec(query, 1, 2)
+ }
+
+ test("generate") {
+ val query = "select a, key, explode(d) from testView where a > 10"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("subquery") {
+ testData
Review comment:
@cloud-fan The reason why I am using testData here is that the view test view here can't have extra `Project', but using normal DataFrame creation method it will always create a new `Project` to map their names. So I just reused this test data. Is there a way to create DataFrame without introducing new Projects?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655915346
**[Test build #125436 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125436/testReport)** for PR 29031 at commit [`a24d93f`](https://github.com/apache/spark/commit/a24d93feaa14f01e7878df1a8b2557ec26ea6104).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656072041
**[Test build #125453 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125453/testReport)** for PR 29031 at commit [`a24d93f`](https://github.com/apache/spark/commit/a24d93feaa14f01e7878df1a8b2557ec26ea6104).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668365424
**[Test build #127019 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127019/testReport)** for PR 29031 at commit [`4585a04`](https://github.com/apache/spark/commit/4585a04ef4548022865ea0978040d9dd56df8252).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670051426
**[Test build #127150 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127150/testReport)** for PR 29031 at commit [`abca971`](https://github.com/apache/spark/commit/abca97120db8e6cea71446b9e5e93db08f493e34).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan closed pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #29031:
URL: https://github.com/apache/spark/pull/29031
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655197943
Can one of the admins verify this patch?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r452666532
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/RemoveRedundantProjectsSuite.scala
##########
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.{DataFrame, QueryTest}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
+import org.apache.spark.util.Utils
+
+class RemoveRedundantProjectsSuite extends QueryTest with SharedSparkSession with SQLTestUtils {
+
+ private def assertProjectExecCount(df: DataFrame, expected: Integer): Unit = {
+ withClue(df.queryExecution) {
+ val plan = df.queryExecution.executedPlan
+ val actual = plan.collectWithSubqueries { case p: ProjectExec => p }.size
+ assert(actual == expected)
+ }
+ }
+
+ private def assertProjectExec(query: String, enabled: Integer, disabled: Integer): Unit = {
+ val df = sql(query)
+ assertProjectExecCount(df, enabled)
+ val result = df.collect()
+ withSQLConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED.key -> "false") {
+ val df2 = sql(query)
+ assertProjectExecCount(df2, disabled)
+ checkAnswer(df2, result)
+ }
+ }
+
+ private val tmpPath = Utils.createTempDir()
+
+ override def beforeAll(): Unit = {
+ super.beforeAll()
+ tmpPath.delete()
+ val path = tmpPath.getAbsolutePath
+ spark.range(100).selectExpr("id % 10 as key", "cast(id * 2 as int) as a",
+ "cast(id * 3 as int) as b", "cast(id as string) as c", "array(id, id + 1, id + 3) as d")
+ .write.partitionBy("key").parquet(path)
+ spark.read.parquet(path).createOrReplaceTempView("testView")
+ }
+
+ override def afterAll(): Unit = {
+ Utils.deleteRecursively(tmpPath)
+ super.afterAll()
+ }
+
+ test("project") {
+ val query = "select * from testView"
+ assertProjectExec(query, 0, 0)
+ }
+
+ test("project with filter") {
+ val query = "select * from testView where a > 5"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("project with specific column ordering") {
+ val query = "select key, a, b, c from testView"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("project with extra columns") {
+ val query = "select a, b, c, key, a from testView"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("project with fewer columns") {
+ val query = "select a from testView where a > 3"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("aggregate without ordering requirement") {
+ val query = "select sum(a) as sum_a, key, last(b) as last_b " +
+ "from (select key, a, b from testView where a > 100) group by key"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("aggregate with ordering requirement") {
+ val query = "select a, sum(b) as sum_b from testView group by a"
+ assertProjectExec(query, 1, 1)
+ }
+
+ test("join without ordering requirement") {
+ val query = "select t1.key, t2.key, t1.a, t2.b from (select key, a, b, c from testView)" +
+ " as t1 join (select key, a, b, c from testView) as t2 on t1.c > t2.c and t1.key > 10"
+ assertProjectExec(query, 1, 3)
+ }
+
+ test("join with ordering requirement") {
+ val query = "select * from (select key, a, c, b from testView) as t1 join " +
+ "(select key, a, b, c from testView) as t2 on t1.key = t2.key where t2.a > 50"
+ assertProjectExec(query, 2, 2)
+ }
+
+ test("window function") {
+ val query = "select key, b, avg(a) over (partition by key order by a " +
+ "rows between 1 preceding and 1 following) as avg from testView"
+ assertProjectExec(query, 1, 2)
+ }
+
+ test("generate") {
+ val query = "select a, key, explode(d) from testView where a > 10"
+ assertProjectExec(query, 0, 1)
+ }
+
+ test("subquery") {
+ testData
Review comment:
I think it's more clear to create a new view here for testing.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r467349934
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/RemoveRedundantProjects.scala
##########
@@ -78,9 +86,11 @@ case class RemoveRedundantProjects(conf: SQLConf) extends Rule[SparkPlan] {
case d: DataSourceV2ScanExecBase if !d.supportsColumnar => false
case _ =>
if (requireOrdering) {
- project.output.map(_.exprId.id) == child.output.map(_.exprId.id)
+ project.output.map(_.exprId.id) == child.output.map(_.exprId.id) &&
+ checkNullability(project.output, child.output)
} else {
- project.output.map(_.exprId.id).sorted == child.output.map(_.exprId.id).sorted
+ project.output.map(_.exprId.id).sorted == child.output.map(_.exprId.id).sorted &&
+ checkNullability(project.output, child.output)
Review comment:
it should be
```
val orderedProjectOutput = project.output.sortBy(_.exprId.id)
val orderedChildOutput = child.output.sortBy(_.exprId.id)
orderedProjectOutput.map(_.expr.id) == orderedChildOutput.map(_.exprId.id) &&
checkNullability(orderedProjectOutput, orderedChildOutput)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670351444
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670189094
**[Test build #127155 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127155/testReport)** for PR 29031 at commit [`1632028`](https://github.com/apache/spark/commit/1632028d2ac54e8bbb3970f81f0c6f3f8eacb32f).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655198271
Can one of the admins verify this patch?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656521479
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-656072241
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/125453/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670240289
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671629396
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670276032
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670642619
**[Test build #127212 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127212/testReport)** for PR 29031 at commit [`feabc1f`](https://github.com/apache/spark/commit/feabc1fb0406c739602ee0683bdd03e29dc7ea71).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671485627
**[Test build #127289 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127289/testReport)** for PR 29031 at commit [`8495025`](https://github.com/apache/spark/commit/84950256be633777ff461919b93b2e73bec2d899).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671486262
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670643137
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670189094
**[Test build #127155 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127155/testReport)** for PR 29031 at commit [`1632028`](https://github.com/apache/spark/commit/1632028d2ac54e8bbb3970f81f0c6f3f8eacb32f).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670237398
Merged build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r452665849
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/RemoveRedundantProjects.scala
##########
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.catalyst.expressions.aggregate.{Final, PartialMerge}
+import org.apache.spark.sql.catalyst.rules.Rule
+import org.apache.spark.sql.execution.aggregate.BaseAggregateExec
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2ScanExecBase
+import org.apache.spark.sql.execution.window.WindowExec
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * Remove redundant ProjectExec node from the spark plan. A ProjectExec node is redundant when
+ * - It has the same output attributes and orders as its child's output and the ordering of
+ * the attributes is required.
+ * - It has the same output attributes as its child's output when attribute output ordering
+ * is not required.
+ * This rule needs to be a physical rule because project nodes are useful during logical
+ * optimization to prune data. During physical planning, redundant project nodes can be removed
+ * to simplify the query plan.
+ */
+case class RemoveRedundantProjects(conf: SQLConf) extends Rule[SparkPlan] {
+ def apply(plan: SparkPlan): SparkPlan = {
+ if (!conf.getConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED)) {
+ plan
+ } else {
+ removeProject(plan, true)
+ }
+ }
+
+ private def removeProject(plan: SparkPlan, requireOrdering: Boolean): SparkPlan = {
+ plan match {
+ case p @ ProjectExec(_, child) =>
+ if (isRedundant(p, child, requireOrdering)) {
+ val newPlan = removeProject(child, requireOrdering)
+ newPlan.setLogicalLink(child.logicalLink.get)
+ newPlan
+ } else {
+ p.mapChildren(removeProject(_, false))
+ }
+ case op: TakeOrderedAndProjectExec =>
+ op.mapChildren(removeProject(_, false))
+ case a: BaseAggregateExec =>
+ // BaseAggregateExec require specific column ordering when mode is Final or PartialMerge.
+ // See comments in BaseAggregateExec inputAttributes method.
+ val keepOrdering = a.aggregateExpressions
+ .exists(ae => ae.mode.equals(Final) || ae.mode.equals(PartialMerge))
+ a.mapChildren(removeProject(_, keepOrdering))
+ case g: GenerateExec => g.mapChildren(removeProject(_, false))
+ // JoinExec ordering requirement will inherit from its parent. If there is no ProjectExec in
+ // its ancestors, JoinExec should require output columns to be ordered.
+ case o => o.mapChildren(removeProject(_, requireOrdering))
+ }
+ }
+
+ private def isRedundant(
+ project: ProjectExec,
+ child: SparkPlan,
+ requireOrdering: Boolean): Boolean = {
+ child match {
+ // If a DataSourceV2ScanExec node does not support columnar, a ProjectExec node is required
+ // to convert the rows to UnsafeRow. See DataSourceV2Strategy for more details.
+ case d: DataSourceV2ScanExecBase if !d.supportsColumnar => false
+ case _ =>
+ if (requireOrdering) {
+ project.output.map(_.exprId.id) == child.output.map(_.exprId.id)
Review comment:
I don't think so. `AttributeReferece.sameRef` doesn't consider qualifier as well.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671504497
**[Test build #127290 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127290/testReport)** for PR 29031 at commit [`394126d`](https://github.com/apache/spark/commit/394126da654c15c59a58bd906f0ca4564ce1c4e5).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maryannxue commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
maryannxue commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r451205382
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2935,6 +2944,8 @@ class SQLConf extends Serializable with Logging {
def subqueryReuseEnabled: Boolean = getConf(SUBQUERY_REUSE_ENABLED)
+ def removeRedundantProjectsEnabled: Boolean = getConf(REMOVE_REDUNDANT_PROJECTS_ENABLED)
Review comment:
nit: Since this conf is used only once, we can remove this variable.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670309030
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670642619
**[Test build #127212 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127212/testReport)** for PR 29031 at commit [`feabc1f`](https://github.com/apache/spark/commit/feabc1fb0406c739602ee0683bdd03e29dc7ea71).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671629396
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671505080
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670351444
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671628547
**[Test build #127290 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127290/testReport)** for PR 29031 at commit [`394126d`](https://github.com/apache/spark/commit/394126da654c15c59a58bd906f0ca4564ce1c4e5).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r452031830
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/RemoveRedundantProjectsSuite.scala
##########
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.{DataFrame, QueryTest}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.SharedSparkSession
+
+class RemoveRedundantProjectsSuite extends QueryTest with SharedSparkSession {
+
+ private def assertProjectExecCount(df: DataFrame, expected: Integer): Unit = {
+ withClue(df.queryExecution) {
+ val plan = df.queryExecution.executedPlan
+ val actual = plan.collectWithSubqueries { case p: ProjectExec => p }.size
+ assert(actual == expected)
+ }
+ }
+
+ private def assertProjectExec(query: String, enabled: Integer, disabled: Integer): Unit = {
+ val df = sql(query)
+ assertProjectExecCount(df, enabled)
+ val result1 = df.collect()
+ withSQLConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED.key -> "false") {
+ val df2 = sql(query)
+ assertProjectExecCount(df2, disabled)
+ QueryTest.sameRows(result1.toSeq, df2.collect().toSeq)
+ }
+ }
+
+ private def withTestView(f: => Unit): Unit = {
+ withTempPath { p =>
+ val path = p.getAbsolutePath
+ spark.range(100).selectExpr("id % 10 as key", "id * 2 as a",
+ "id * 3 as b", "cast(id as string) as c", "array(id, id + 1, id + 3) as d")
+ .write.partitionBy("key").parquet(path)
+ spark.read.parquet(path).createOrReplaceTempView("testView")
Review comment:
Shall we put the view creation in `beforeAll`? Then we only need to do it once for the entire test suite.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668981110
**[Test build #127077 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127077/testReport)** for PR 29031 at commit [`4585a04`](https://github.com/apache/spark/commit/4585a04ef4548022865ea0978040d9dd56df8252).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671486262
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] allisonwang-db commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
allisonwang-db commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670274753
retest this please
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-669015424
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668356800
**[Test build #127019 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127019/testReport)** for PR 29031 at commit [`4585a04`](https://github.com/apache/spark/commit/4585a04ef4548022865ea0978040d9dd56df8252).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668357156
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671699494
thanks, merging to master!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668356800
**[Test build #127019 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127019/testReport)** for PR 29031 at commit [`4585a04`](https://github.com/apache/spark/commit/4585a04ef4548022865ea0978040d9dd56df8252).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] gatorsmile commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
gatorsmile commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655913481
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671485627
**[Test build #127289 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127289/testReport)** for PR 29031 at commit [`8495025`](https://github.com/apache/spark/commit/84950256be633777ff461919b93b2e73bec2d899).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670240289
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-668980249
retest this please
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r452030072
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/RemoveRedundantProjects.scala
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.catalyst.expressions.aggregate.{Final, PartialMerge}
+import org.apache.spark.sql.catalyst.rules.Rule
+import org.apache.spark.sql.execution.aggregate.BaseAggregateExec
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2ScanExecBase
+import org.apache.spark.sql.execution.window.WindowExec
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * Remove redundant ProjectExec node from the spark plan. A ProjectExec node is redundant when
+ * - It has the same output attributes and orders as its child's output and the ordering of
+ * the attributes is required.
+ * - It has the same output attributes as its child's output when attribute output ordering
+ * is not required.
+ * This rule needs to be a physical rule because project nodes are useful during logical
+ * optimization to prune data. During physical planning, redundant project nodes can be removed
+ * to simplify the query plan.
+ */
+case class RemoveRedundantProjects(conf: SQLConf) extends Rule[SparkPlan] {
+ def apply(plan: SparkPlan): SparkPlan = {
+ if (!conf.getConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED)) {
+ plan
+ } else {
+ removeProject(plan, true)
+ }
+ }
+
+ private def removeProject(plan: SparkPlan, requireOrdering: Boolean): SparkPlan = {
+ plan match {
+ case p @ ProjectExec(_, child) =>
+ if (isRedundant(p, child, requireOrdering)) {
+ val newPlan = removeProject(child, requireOrdering)
+ newPlan.setLogicalLink(child.logicalLink.get)
+ newPlan
+ } else {
+ p.mapChildren(removeProject(_, false))
+ }
+ case op: TakeOrderedAndProjectExec =>
+ op.mapChildren(removeProject(_, false))
+ case a: BaseAggregateExec =>
+ // BaseAggregateExec require specific column ordering when mode is Final or PartialMerge.
+ // See comments in BaseAggregateExec inputAttributes method.
+ val keepOrdering = a.aggregateExpressions
+ .exists(ae => ae.mode.equals(Final) || ae.mode.equals(PartialMerge))
+ a.mapChildren(removeProject(_, keepOrdering))
+ case w: WindowExec => w.mapChildren(removeProject(_, false))
Review comment:
`WindowExec.output` is implemented as `child.output ++ windowExpression.map(_.toAttribute)`. I think we require the ordering for window children.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670275716
**[Test build #127163 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/127163/testReport)** for PR 29031 at commit [`6d5cade`](https://github.com/apache/spark/commit/6d5cadec111cfe64f55d79a1cc95873830267a16).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670643137
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-670237398
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-655942958
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671505080
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maryannxue commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
maryannxue commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r451205755
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/RemoveRedundantProjects.scala
##########
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.catalyst.expressions.aggregate.{Final, PartialMerge}
+import org.apache.spark.sql.catalyst.rules.Rule
+import org.apache.spark.sql.execution.aggregate.BaseAggregateExec
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2ScanExecBase
+import org.apache.spark.sql.execution.window.WindowExec
+import org.apache.spark.sql.internal.SQLConf
+
+
+case class RemoveRedundantProjects(conf: SQLConf) extends Rule[SparkPlan] {
Review comment:
javadoc: what it does. why is it needed? why does it have to be a physical rule? etc.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] allisonwang-db commented on a change in pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
allisonwang-db commented on a change in pull request #29031:
URL: https://github.com/apache/spark/pull/29031#discussion_r452598182
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/RemoveRedundantProjects.scala
##########
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution
+
+import org.apache.spark.sql.catalyst.expressions.aggregate.{Final, PartialMerge}
+import org.apache.spark.sql.catalyst.rules.Rule
+import org.apache.spark.sql.execution.aggregate.BaseAggregateExec
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2ScanExecBase
+import org.apache.spark.sql.execution.window.WindowExec
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * Remove redundant ProjectExec node from the spark plan. A ProjectExec node is redundant when
+ * - It has the same output attributes and orders as its child's output and the ordering of
+ * the attributes is required.
+ * - It has the same output attributes as its child's output when attribute output ordering
+ * is not required.
+ * This rule needs to be a physical rule because project nodes are useful during logical
+ * optimization to prune data. During physical planning, redundant project nodes can be removed
+ * to simplify the query plan.
+ */
+case class RemoveRedundantProjects(conf: SQLConf) extends Rule[SparkPlan] {
+ def apply(plan: SparkPlan): SparkPlan = {
+ if (!conf.getConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED)) {
+ plan
+ } else {
+ removeProject(plan, true)
+ }
+ }
+
+ private def removeProject(plan: SparkPlan, requireOrdering: Boolean): SparkPlan = {
+ plan match {
+ case p @ ProjectExec(_, child) =>
+ if (isRedundant(p, child, requireOrdering)) {
+ val newPlan = removeProject(child, requireOrdering)
+ newPlan.setLogicalLink(child.logicalLink.get)
+ newPlan
+ } else {
+ p.mapChildren(removeProject(_, false))
+ }
+ case op: TakeOrderedAndProjectExec =>
+ op.mapChildren(removeProject(_, false))
+ case a: BaseAggregateExec =>
+ // BaseAggregateExec require specific column ordering when mode is Final or PartialMerge.
+ // See comments in BaseAggregateExec inputAttributes method.
+ val keepOrdering = a.aggregateExpressions
+ .exists(ae => ae.mode.equals(Final) || ae.mode.equals(PartialMerge))
+ a.mapChildren(removeProject(_, keepOrdering))
+ case g: GenerateExec => g.mapChildren(removeProject(_, false))
+ // JoinExec ordering requirement will inherit from its parent. If there is no ProjectExec in
+ // its ancestors, JoinExec should require output columns to be ordered.
+ case o => o.mapChildren(removeProject(_, requireOrdering))
+ }
+ }
+
+ private def isRedundant(
+ project: ProjectExec,
+ child: SparkPlan,
+ requireOrdering: Boolean): Boolean = {
+ child match {
+ // If a DataSourceV2ScanExec node does not support columnar, a ProjectExec node is required
+ // to convert the rows to UnsafeRow. See DataSourceV2Strategy for more details.
+ case d: DataSourceV2ScanExecBase if !d.supportsColumnar => false
+ case _ =>
+ if (requireOrdering) {
+ project.output.map(_.exprId.id) == child.output.map(_.exprId.id)
Review comment:
@cloud-fan I am wondering if the `qualifier` in Attribute should be considered here as well (besides `exprId`). Would an attribute qualifier in a `ProjectExec` be different from its child?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29031: [SPARK-32216][SQL] Remove redundant ProjectExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29031:
URL: https://github.com/apache/spark/pull/29031#issuecomment-671580796
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org