Class JavaDoubleRDD

Object
org.apache.spark.api.java.JavaDoubleRDD
All Implemented Interfaces:
Serializable, JavaRDDLike<Double,JavaDoubleRDD>, scala.Serializable

public class JavaDoubleRDD extends Object
See Also:
  • Constructor Details

    • JavaDoubleRDD

      public JavaDoubleRDD(RDD<Object> srdd)
  • Method Details

    • fromRDD

      public static JavaDoubleRDD fromRDD(RDD<Object> rdd)
    • toRDD

      public static RDD<Object> toRDD(JavaDoubleRDD rdd)
    • srdd

      public RDD<Object> srdd()
    • classTag

      public scala.reflect.ClassTag<Double> classTag()
    • rdd

      public RDD<Double> rdd()
    • wrapRDD

      public JavaDoubleRDD wrapRDD(RDD<Double> rdd)
    • cache

      public JavaDoubleRDD cache()
      Persist this RDD with the default storage level (MEMORY_ONLY).
      Returns:
      (undocumented)
    • persist

      public JavaDoubleRDD persist(StorageLevel newLevel)
      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.
      Parameters:
      newLevel - (undocumented)
      Returns:
      (undocumented)
    • unpersist

      public JavaDoubleRDD unpersist()
      Mark the RDD as non-persistent, and remove all blocks for it from memory and disk. This method blocks until all blocks are deleted.
      Returns:
      (undocumented)
    • unpersist

      public JavaDoubleRDD unpersist(boolean blocking)
      Mark the RDD as non-persistent, and remove all blocks for it from memory and disk.

      Parameters:
      blocking - Whether to block until all blocks are deleted.
      Returns:
      (undocumented)
    • first

      public Double first()
      Description copied from interface: JavaRDDLike
      Return the first element in this RDD.
      Returns:
      (undocumented)
    • distinct

      public JavaDoubleRDD distinct()
      Return a new RDD containing the distinct elements in this RDD.
      Returns:
      (undocumented)
    • distinct

      public JavaDoubleRDD distinct(int numPartitions)
      Return a new RDD containing the distinct elements in this RDD.
      Parameters:
      numPartitions - (undocumented)
      Returns:
      (undocumented)
    • filter

      public JavaDoubleRDD filter(Function<Double,Boolean> f)
      Return a new RDD containing only the elements that satisfy a predicate.
      Parameters:
      f - (undocumented)
      Returns:
      (undocumented)
    • coalesce

      public JavaDoubleRDD coalesce(int numPartitions)
      Return a new RDD that is reduced into numPartitions partitions.
      Parameters:
      numPartitions - (undocumented)
      Returns:
      (undocumented)
    • coalesce

      public JavaDoubleRDD coalesce(int numPartitions, boolean shuffle)
      Return a new RDD that is reduced into numPartitions partitions.
      Parameters:
      numPartitions - (undocumented)
      shuffle - (undocumented)
      Returns:
      (undocumented)
    • repartition

      public JavaDoubleRDD repartition(int numPartitions)
      Return a new RDD that has exactly numPartitions partitions.

      Can increase or decrease the level of parallelism in this RDD. Internally, this uses a shuffle to redistribute data.

      If you are decreasing the number of partitions in this RDD, consider using coalesce, which can avoid performing a shuffle.

      Parameters:
      numPartitions - (undocumented)
      Returns:
      (undocumented)
    • subtract

      public JavaDoubleRDD subtract(JavaDoubleRDD other)
      Return an RDD with the elements from this that are not in other.

      Uses this partitioner/partition size, because even if other is huge, the resulting RDD will be &lt;= us.

      Parameters:
      other - (undocumented)
      Returns:
      (undocumented)
    • subtract

      public JavaDoubleRDD subtract(JavaDoubleRDD other, int numPartitions)
      Return an RDD with the elements from this that are not in other.
      Parameters:
      other - (undocumented)
      numPartitions - (undocumented)
      Returns:
      (undocumented)
    • subtract

      public JavaDoubleRDD subtract(JavaDoubleRDD other, Partitioner p)
      Return an RDD with the elements from this that are not in other.
      Parameters:
      other - (undocumented)
      p - (undocumented)
      Returns:
      (undocumented)
    • sample

      public JavaDoubleRDD sample(boolean withReplacement, Double fraction)
      Return a sampled subset of this RDD.
      Parameters:
      withReplacement - (undocumented)
      fraction - (undocumented)
      Returns:
      (undocumented)
    • sample

      public JavaDoubleRDD sample(boolean withReplacement, Double fraction, long seed)
      Return a sampled subset of this RDD.
      Parameters:
      withReplacement - (undocumented)
      fraction - (undocumented)
      seed - (undocumented)
      Returns:
      (undocumented)
    • union

      public JavaDoubleRDD union(JavaDoubleRDD other)
      Return the union of this RDD and another one. Any identical elements will appear multiple times (use .distinct() to eliminate them).
      Parameters:
      other - (undocumented)
      Returns:
      (undocumented)
    • intersection

      public JavaDoubleRDD intersection(JavaDoubleRDD other)
      Return the intersection of this RDD and another one. The output will not contain any duplicate elements, even if the input RDDs did.

      Parameters:
      other - (undocumented)
      Returns:
      (undocumented)
      Note:
      This method performs a shuffle internally.
    • sum

      public Double sum()
      Add up the elements in this RDD.
    • min

      public Double min()
      Returns the minimum element from this RDD as defined by the default comparator natural order.
      Returns:
      the minimum of the RDD
    • max

      public Double max()
      Returns the maximum element from this RDD as defined by the default comparator natural order.
      Returns:
      the maximum of the RDD
    • stats

      public StatCounter stats()
      Return a StatCounter object that captures the mean, variance and count of the RDD's elements in one operation.
      Returns:
      (undocumented)
    • mean

      public Double mean()
      Compute the mean of this RDD's elements.
    • variance

      public Double variance()
      Compute the population variance of this RDD's elements.
    • stdev

      public Double stdev()
      Compute the population standard deviation of this RDD's elements.
    • sampleStdev

      public Double sampleStdev()
      Compute the sample standard deviation of this RDD's elements (which corrects for bias in estimating the standard deviation by dividing by N-1 instead of N).
      Returns:
      (undocumented)
    • sampleVariance

      public Double sampleVariance()
      Compute the sample variance of this RDD's elements (which corrects for bias in estimating the standard variance by dividing by N-1 instead of N).
      Returns:
      (undocumented)
    • popStdev

      public Double popStdev()
      Compute the population standard deviation of this RDD's elements.
      Returns:
      (undocumented)
    • popVariance

      public Double popVariance()
      Compute the population variance of this RDD's elements.
      Returns:
      (undocumented)
    • meanApprox

      public PartialResult<BoundedDouble> meanApprox(long timeout, Double confidence)
      Return the approximate mean of the elements in this RDD.
    • meanApprox

      public PartialResult<BoundedDouble> meanApprox(long timeout)
      Approximate operation to return the mean within a timeout.
      Parameters:
      timeout - (undocumented)
      Returns:
      (undocumented)
    • sumApprox

      public PartialResult<BoundedDouble> sumApprox(long timeout, Double confidence)
      Approximate operation to return the sum within a timeout.
      Parameters:
      timeout - (undocumented)
      confidence - (undocumented)
      Returns:
      (undocumented)
    • sumApprox

      public PartialResult<BoundedDouble> sumApprox(long timeout)
      Approximate operation to return the sum within a timeout.
      Parameters:
      timeout - (undocumented)
      Returns:
      (undocumented)
    • histogram

      public scala.Tuple2<double[],long[]> histogram(int bucketCount)
      Compute a histogram of the data using bucketCount number of buckets evenly spaced between the minimum and maximum of the RDD. For example if the min value is 0 and the max is 100 and there are two buckets the resulting buckets will be [0,50) [50,100]. bucketCount must be at least 1 If the RDD contains infinity, NaN throws an exception If the elements in RDD do not vary (max == min) always returns a single bucket.
      Parameters:
      bucketCount - (undocumented)
      Returns:
      (undocumented)
    • histogram

      public long[] histogram(double[] buckets)
      Compute a histogram using the provided buckets. The buckets are all open to the left except for the last which is closed e.g. for the array [1,10,20,50] the buckets are [1,10) [10,20) [20,50] e.g 1&lt;=x&lt;10 , 10&lt;=x&lt;20, 20&lt;=x&lt;50 And on the input of 1 and 50 we would have a histogram of 1,0,0

      Parameters:
      buckets - (undocumented)
      Returns:
      (undocumented)
      Note:
      If your histogram is evenly spaced (e.g. [0, 10, 20, 30]) this can be switched from an O(log n) insertion to O(1) per element. (where n = # buckets) if you set evenBuckets to true. buckets must be sorted and not contain any duplicates. buckets array must be at least two elements All NaN entries are treated the same. If you have a NaN bucket it must be the maximum value of the last position and all NaN entries will be counted in that bucket.
    • histogram

      public long[] histogram(Double[] buckets, boolean evenBuckets)
    • setName

      public JavaDoubleRDD setName(String name)
      Assign a name to this RDD