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 2021/04/30 06:16:09 UTC
[GitHub] [spark] wangyum opened a new pull request #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
wangyum opened a new pull request #32405:
URL: https://github.com/apache/spark/pull/32405
### What changes were proposed in this pull request?
This pr makes `CombineFilters` support non-deterministic expressions. For example:
```sql
spark.sql("CREATE TABLE t1(id INT, dt STRING) using parquet PARTITIONED BY (dt)")
spark.sql("CREATE VIEW v1 AS SELECT * FROM t1 WHERE dt NOT IN ('2020-01-01', '2021-01-01')")
spark.sql("SELECT * FROM v1 WHERE dt = '2021-05-01' AND rand() <= 0.01").explain()
```
Before this pr:
```
== Physical Plan ==
*(1) Filter (isnotnull(dt#1) AND ((dt#1 = 2021-05-01) AND (rand(-6723800298719475098) <= 0.01)))
+- *(1) ColumnarToRow
+- FileScan parquet default.t1[id#0,dt#1] Batched: true, DataFilters: [], Format: Parquet, Location: InMemoryFileIndex(0 paths)[], PartitionFilters: [NOT dt#1 IN (2020-01-01,2021-01-01)], PushedFilters: [], ReadSchema: struct<id:int>
```
After this pr:
```
== Physical Plan ==
*(1) Filter (rand(-2400509328955813273) <= 0.01)
+- *(1) ColumnarToRow
+- FileScan parquet default.t1[id#0,dt#1] Batched: true, DataFilters: [], Format: Parquet, Location: InMemoryFileIndex(0 paths)[], PartitionFilters: [isnotnull(dt#1), NOT dt#1 IN (2020-01-01,2021-01-01), (dt#1 = 2021-05-01)], PushedFilters: [], ReadSchema: struct<id:int>
```
### Why are the changes needed?
Improve query performance.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Unit test.
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830009370
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/42630/
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-829978534
**[Test build #138109 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138109/testReport)** for PR 32405 at commit [`26a0c07`](https://github.com/apache/spark/commit/26a0c0782eb14c7c1afffbd3369e9ed3dbb3ac5b).
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830009345
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/42630/
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #32405:
URL: https://github.com/apache/spark/pull/32405
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830022342
**[Test build #138102 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138102/testReport)** for PR 32405 at commit [`9eefb08`](https://github.com/apache/spark/commit/9eefb081daebd49ee5bf39900de04037c4e2d65c).
* 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 commented on pull request #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830006774
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/42630/
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32405:
URL: https://github.com/apache/spark/pull/32405#discussion_r623748062
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/PruneFiltersSuite.scala
##########
@@ -160,4 +160,17 @@ class PruneFiltersSuite extends PlanTest {
comparePlans(optimized, correctAnswer)
}
}
+
+ test("SPARK-35273: CombineFilters support non-deterministic expressions") {
+ val x = testRelation.where(!'a.attr.in(1, 3, 5)).subquery('x)
+
+ comparePlans(
+ Optimize.execute(x.where('a.attr === 7 && Rand(10) > 0.1).analyze),
+ testRelation.where(!'a.attr.in(1, 3, 5) && 'a.attr === 7).where(Rand(10) > 0.1).analyze)
+
+ comparePlans(
+ Optimize.execute(x.where('a.attr === 7 && Rand(10) > 0.1 && Rand(10) < 1.1).analyze),
Review comment:
we can test a deterministic predicate after the `Rand(10) > 0.1`.
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830035363
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138102/
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-829978534
**[Test build #138109 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138109/testReport)** for PR 32405 at commit [`26a0c07`](https://github.com/apache/spark/commit/26a0c0782eb14c7c1afffbd3369e9ed3dbb3ac5b).
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830141594
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138109/
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830009370
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/42630/
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830558441
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] AmplabJenkins removed a comment on pull request #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-829906466
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/42622/
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830130164
**[Test build #138109 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138109/testReport)** for PR 32405 at commit [`26a0c07`](https://github.com/apache/spark/commit/26a0c0782eb14c7c1afffbd3369e9ed3dbb3ac5b).
* 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 commented on pull request #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-829906466
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/42622/
--
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] maropu commented on pull request #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
maropu commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830703604
late lgtm. Thanks you, @wangyum ~
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-829897896
Kubernetes integration test unable to build dist.
exiting with code: 1
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/42622/
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830141594
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138109/
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-829877748
**[Test build #138102 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138102/testReport)** for PR 32405 at commit [`9eefb08`](https://github.com/apache/spark/commit/9eefb081daebd49ee5bf39900de04037c4e2d65c).
--
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] wangyum commented on a change in pull request #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
wangyum commented on a change in pull request #32405:
URL: https://github.com/apache/spark/pull/32405#discussion_r623808358
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/PruneFiltersSuite.scala
##########
@@ -160,4 +160,17 @@ class PruneFiltersSuite extends PlanTest {
comparePlans(optimized, correctAnswer)
}
}
+
+ test("SPARK-35273: CombineFilters support non-deterministic expressions") {
+ val x = testRelation.where(!'a.attr.in(1, 3, 5)).subquery('x)
+
+ comparePlans(
+ Optimize.execute(x.where('a.attr === 7 && Rand(10) > 0.1).analyze),
+ testRelation.where(!'a.attr.in(1, 3, 5) && 'a.attr === 7).where(Rand(10) > 0.1).analyze)
+
+ comparePlans(
+ Optimize.execute(x.where('a.attr === 7 && Rand(10) > 0.1 && Rand(10) < 1.1).analyze),
Review comment:
Fixed.
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-829877748
**[Test build #138102 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138102/testReport)** for PR 32405 at commit [`9eefb08`](https://github.com/apache/spark/commit/9eefb081daebd49ee5bf39900de04037c4e2d65c).
--
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 #32405: [SPARK-35273][SQL] CombineFilters support non-deterministic expressions
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32405:
URL: https://github.com/apache/spark/pull/32405#issuecomment-830035363
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138102/
--
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