[GitHub] spark pull request #15899: [SPARK-18466] added withFilter method to RDD

2018-11-10 Thread asfgit
Github user asfgit closed the pull request at:

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


---

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



[GitHub] spark pull request #15899: [SPARK-18466] added withFilter method to RDD

2018-11-06 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/15899#discussion_r231390266
  
--- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
@@ -387,6 +387,14 @@ abstract class RDD[T: ClassTag](
   preservesPartitioning = true)
   }
 
+  /**
+* Return a new RDD containing only the elements that satisfy a 
predicate.
--- End diff --

Why bother unless we have consensus to introduce this API?



---

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



[GitHub] spark pull request #15899: [SPARK-18466] added withFilter method to RDD

2018-11-06 Thread dongjoon-hyun
Github user dongjoon-hyun commented on a diff in the pull request:

https://github.com/apache/spark/pull/15899#discussion_r231389555
  
--- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
@@ -387,6 +387,14 @@ abstract class RDD[T: ClassTag](
   preservesPartitioning = true)
   }
 
+  /**
+* Return a new RDD containing only the elements that satisfy a 
predicate.
--- End diff --

Hi, @reggert . 
Could you fix the indentation?


---

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



[GitHub] spark pull request #15899: [SPARK-18466] added withFilter method to RDD

2016-11-16 Thread reggert
Github user reggert commented on a diff in the pull request:

https://github.com/apache/spark/pull/15899#discussion_r88267555
  
--- Diff: core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala ---
@@ -70,6 +70,7 @@ class RDDSuite extends SparkFunSuite with 
SharedSparkContext {
 assert(!nums.isEmpty())
 assert(nums.max() === 4)
 assert(nums.min() === 1)
+assert((for (n <- nums if n > 2) yield n).collect().toList === List(3, 
4))
--- End diff --

According to IntelliJ, the `for` comprehension desugars into
```scala
nums.withFilter(n => n > 2).map(n => n)
```


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

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



[GitHub] spark pull request #15899: [SPARK-18466] added withFilter method to RDD

2016-11-15 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/15899#discussion_r88180989
  
--- Diff: core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala ---
@@ -70,6 +70,7 @@ class RDDSuite extends SparkFunSuite with 
SharedSparkContext {
 assert(!nums.isEmpty())
 assert(nums.max() === 4)
 assert(nums.min() === 1)
+assert((for (n <- nums if n > 2) yield n).collect().toList === List(3, 
4))
--- End diff --

what does this get compiled into?



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

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



[GitHub] spark pull request #15899: [SPARK-18466] added withFilter method to RDD

2016-11-15 Thread reggert
GitHub user reggert opened a pull request:

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

[SPARK-18466] added withFilter method to RDD

## What changes were proposed in this pull request?

A `withFilter` method has been added to `RDD` as an alias for the `filter` 
method. When using `for` comprehensions, the Scala compiler prefers (and as of 
2.12, _requires_) the lazy `withFilter` method, only falling back to using the 
`filter` method (which, for regular collections, is non-lazy, but for RDDs is 
lazy). Prior to Scala 2.12, this fallback causes the compiler to emit a 
warning, and as of Scala 2.12, it results in an error.

## How was this patch tested?

`RDDSuite` was updated by adding a line to "basic operations" that 
duplicates the behavior of the `filter` test, but uses a `for` comprehension 
instead of a direct method call.




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

$ git pull https://github.com/reggert/spark feature/withfilter

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

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

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

This closes #15899


commit db9cf5a9627755e1c8e212b7f29d54dc8bed1c54
Author: Richard W. Eggert II 
Date:   2016-11-16T05:52:27Z

[SPARK-18466] added withFilter method to RDD




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

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