Skip to content

Instantly share code, notes, and snippets.

@cerisier
Created April 10, 2016 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cerisier/b984def4e745e954cdc0b987c49f8056 to your computer and use it in GitHub Desktop.
Save cerisier/b984def4e745e954cdc0b987c49f8056 to your computer and use it in GitHub Desktop.
/**
* Return a new RDD by applying a function to all elements of this RDD.
*/
def map[U: ClassTag](f: T => U): RDD[U] = withScope {
val cleanF = sc.clean(f)
new MapPartitionsRDD[U, T](this, (context, pid, iter) => iter.map(cleanF))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment