Skip to content

Instantly share code, notes, and snippets.

@cerisier
Created April 10, 2016 14:29
Show Gist options
  • 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