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/01/15 05:39:04 UTC
[GitHub] [spark] LuciferYang opened a new pull request #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
LuciferYang opened a new pull request #31190:
URL: https://github.com/apache/spark/pull/31190
### What changes were proposed in this pull request?
This pr use `exists` or `forall` to simplify `filter + emptiness check`, it's semantically consistent, but looks simpler. The rule as follow:
- `seq.filter(p).size == 0)` -> `!seq.exists(p)`
- `seq.filter(p).length > 0` -> `seq.exists(p)`
- `seq.filterNot(p).isEmpty` -> `seq.forall(p)`
- `seq.filterNot(p).nonEmpty` -> `!seq.forall(p)`
### Why are the changes needed?
Code Simpilefications.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Pass the Jenkins or GitHub Action
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760690500
----------------------------------------------------------------
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 closed pull request #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
HyukjinKwon closed pull request #31190:
URL: https://github.com/apache/spark/pull/31190
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760786093
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/134087/
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760663527
**[Test build #134078 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/134078/testReport)** for PR 31190 at commit [`09494f9`](https://github.com/apache/spark/commit/09494f9bed3e3da85589c0babbfb690983de42ef).
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760756112
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/38672/
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #31190:
URL: https://github.com/apache/spark/pull/31190#discussion_r557890165
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingQueryListenerSuite.scala
##########
@@ -48,8 +48,7 @@ class StreamingQueryListenerSuite extends StreamTest with BeforeAndAfter {
spark.streams.active.foreach(_.stop())
assert(spark.streams.active.isEmpty)
// Skip check default `StreamingQueryStatusListener` which is for streaming UI.
- assert(spark.streams.listListeners()
- .filterNot(_.isInstanceOf[StreamingQueryStatusListener]).isEmpty)
+ assert(spark.streams.listListeners().forall(_.isInstanceOf[StreamingQueryStatusListener]))
Review comment:
Can we have a newline to match with https://github.com/apache/spark/pull/31188/files#diff-ea70ab4d37b86e958c50f0d0eb0f243c2eb3312c3c0afc78576fa981e5a5a7bbR52?
----------------------------------------------------------------
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] LuciferYang commented on a change in pull request #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
LuciferYang commented on a change in pull request #31190:
URL: https://github.com/apache/spark/pull/31190#discussion_r557896600
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingQueryListenerSuite.scala
##########
@@ -48,8 +48,7 @@ class StreamingQueryListenerSuite extends StreamTest with BeforeAndAfter {
spark.streams.active.foreach(_.stop())
assert(spark.streams.active.isEmpty)
// Skip check default `StreamingQueryStatusListener` which is for streaming UI.
- assert(spark.streams.listListeners()
- .filterNot(_.isInstanceOf[StreamingQueryStatusListener]).isEmpty)
+ assert(spark.streams.listListeners().forall(_.isInstanceOf[StreamingQueryStatusListener]))
Review comment:
Address 4ac192b add a newline
----------------------------------------------------------------
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] LuciferYang commented on a change in pull request #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
LuciferYang commented on a change in pull request #31190:
URL: https://github.com/apache/spark/pull/31190#discussion_r557892183
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingQueryListenerSuite.scala
##########
@@ -48,8 +48,7 @@ class StreamingQueryListenerSuite extends StreamTest with BeforeAndAfter {
spark.streams.active.foreach(_.stop())
assert(spark.streams.active.isEmpty)
// Skip check default `StreamingQueryStatusListener` which is for streaming UI.
- assert(spark.streams.listListeners()
- .filterNot(_.isInstanceOf[StreamingQueryStatusListener]).isEmpty)
+ assert(spark.streams.listListeners().forall(_.isInstanceOf[StreamingQueryStatusListener]))
Review comment:
ok
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760720166
Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38672/
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760690500
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760690020
**[Test build #134087 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/134087/testReport)** for PR 31190 at commit [`4ac192b`](https://github.com/apache/spark/commit/4ac192bd30d9bc0d54330789d9b3b0694203b8df).
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760778507
**[Test build #134087 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/134087/testReport)** for PR 31190 at commit [`4ac192b`](https://github.com/apache/spark/commit/4ac192bd30d9bc0d54330789d9b3b0694203b8df).
* 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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760690020
**[Test build #134087 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/134087/testReport)** for PR 31190 at commit [`4ac192b`](https://github.com/apache/spark/commit/4ac192bd30d9bc0d54330789d9b3b0694203b8df).
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760756112
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/38672/
----------------------------------------------------------------
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 pull request #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760882910
Merged to branch-3.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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760709735
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38672/
----------------------------------------------------------------
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 #31190: [SPARK-34118][CORE][SQL][3.0] Replaces filter and check for emptiness with exists or forall
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #31190:
URL: https://github.com/apache/spark/pull/31190#issuecomment-760786093
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/134087/
----------------------------------------------------------------
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