Last active
April 10, 2016 14:32
-
-
Save cerisier/fad76a73b8a3f59cc69b2660619da82d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Return a new RDD containing only the elements that satisfy a predicate. | |
*/ | |
def filter(f: T => Boolean): RDD[T] = withScope { | |
val cleanF = sc.clean(f) | |
new MapPartitionsRDD[T, T]( | |
this, | |
(context, pid, iter) => iter.filter(cleanF), | |
preservesPartitioning = true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment