Return the union of this RDD and another one.
Return the union of this RDD and another one. Any identical elements will appear multiple
times (use .distinct()
to eliminate them).
Aggregate the elements of each partition, and then the results for all the partitions, using given combine functions and a neutral "zero value".
Aggregate the elements of each partition, and then the results for all the partitions, using given combine functions and a neutral "zero value". This function can return a different result type, U, than the type of this RDD, T. Thus, we need one operation for merging a T into an U and one operation for merging two U's, as in scala.TraversableOnce. Both of these functions are allowed to modify and return their first argument instead of creating a new U to avoid memory allocation.
Persist this RDD with the default storage level (MEMORY_ONLY
).
Return the Cartesian product of this RDD and another one, that is, the RDD of all pairs of
elements (a, b) where a is in this
and b is in other
.
Return an array that contains all of the elements in this RDD.
The SparkContext that this RDD was created on.
Return the number of elements in the RDD.
(Experimental) Approximate version of count() that returns a potentially incomplete result within a timeout, even if not all tasks have finished.
Return the count of each unique value in this RDD as a map of (value, count) pairs.
Return the count of each unique value in this RDD as a map of (value, count) pairs. The final combine step happens locally on the master, equivalent to running a single reduce task.
(Experimental) Approximate version of countByValue().
Return a new RDD containing the distinct elements in this RDD.
Return a new RDD containing only the elements that satisfy a predicate.
Return the first element in this RDD.
Return a new RDD by first applying a function to all elements of this RDD, and then flattening the results.
Aggregate the elements of each partition, and then the results for all the partitions, using a given associative function and a neutral "zero value".
Aggregate the elements of each partition, and then the results for all the partitions, using a given associative function and a neutral "zero value". The function op(t1, t2) is allowed to modify t1 and return it as its result value to avoid object allocation; however, it should not modify t2.
Applies a function f to all elements of this RDD.
Get the RDD's current storage level, or StorageLevel.
Get the RDD's current storage level, or StorageLevel.NONE if none is set.
Return an RDD created by coalescing all elements within each partition into an array.
Return an RDD of grouped items.
Return an RDD of grouped elements.
Return an RDD of grouped elements. Each group consists of a key and a sequence of elements mapping to that key.
A unique ID for this RDD (within its SparkContext).
Internal method to this RDD; will read from cache if applicable, or otherwise compute it.
Internal method to this RDD; will read from cache if applicable, or otherwise compute it. This should not be called by users directly, but is available for implementors of custom subclasses of RDD.
Return a new RDD by applying a function to all elements of this RDD.
Return a new RDD by applying a function to each partition of this RDD.
Return a new RDD by applying a function to each partition of this RDD, while tracking the index of the original partition.
Optionally overridden by subclasses to specify how they are partitioned.
Persist this RDD with the default storage level (MEMORY_ONLY
).
Set this RDD's storage level to persist its values across operations after the first time it is computed.
Set this RDD's storage level to persist its values across operations after the first time it is computed. Can only be called once on each RDD.
Return an RDD created by piping elements to a forked external process.
Return an RDD created by piping elements to a forked external process.
Return an RDD created by piping elements to a forked external process.
Optionally overridden by subclasses to specify placement preferences.
Reduces the elements of this RDD using the specified associative binary operator.
Return a sampled subset of this RDD.
Save this RDD as a SequenceFile of serialized objects.
Save this RDD as a text file, using string representations of elements.
Take the first num elements of the RDD.
Take the first num elements of the RDD. This currently scans the partitions *one by one*, so it will be slow if a lot of partitions are required. In that case, use collect() to get the whole RDD instead.
Return an array that contains all of the elements in this RDD.
Return the union of this RDD and another one.
Return the union of this RDD and another one. Any identical elements will appear multiple
times (use .distinct()
to eliminate them).
A Resilient Distributed Dataset (RDD), the basic abstraction in Spark. Represents an immutable, partitioned collection of elements that can be operated on in parallel. This class contains the basic operations available on all RDDs, such as
map
,filter
, andpersist
. In addition, PairRDDFunctions contains operations available only on RDDs of key-value pairs, such asgroupByKey
andjoin
; DoubleRDDFunctions contains operations available only on RDDs of Doubles; and SequenceFileRDDFunctions contains operations available on RDDs that can be saved as SequenceFiles. These operations are automatically available on any RDD of the right type (e.g. RDD[(Int, Int)] through implicit conversions when youimport spark.SparkContext._
.Internally, each RDD is characterized by five main properties:
All of the scheduling and execution in Spark is done based on these methods, allowing each RDD to implement its own way of computing itself. Indeed, users can implement custom RDDs (e.g. for reading data from a new storage system) by overriding these functions. Please refer to the Spark paper for more details on RDD internals.