Class/Object

org.apache.spark.api.java

JavaSparkContext

Related Docs: object JavaSparkContext | package java

Permalink

class JavaSparkContext extends JavaSparkContextVarargsWorkaround with Closeable

A Java-friendly version of org.apache.spark.SparkContext that returns org.apache.spark.api.java.JavaRDDs and works with Java collections instead of Scala ones.

Only one SparkContext may be active per JVM. You must stop() the active SparkContext before creating a new one. This limitation may eventually be removed; see SPARK-2243 for more details.

Source
JavaSparkContext.scala
Linear Supertypes
Closeable, AutoCloseable, JavaSparkContextVarargsWorkaround, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JavaSparkContext
  2. Closeable
  3. AutoCloseable
  4. JavaSparkContextVarargsWorkaround
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new JavaSparkContext(master: String, appName: String, sparkHome: String, jars: Array[String], environment: Map[String, String])

    Permalink

    master

    Cluster URL to connect to (e.g. mesos://host:port, spark://host:port, local[4]).

    appName

    A name for your application, to display on the cluster web UI

    sparkHome

    The SPARK_HOME directory on the slave nodes

    jars

    Collection of JARs to send to the cluster. These can be paths on the local file system or HDFS, HTTP, HTTPS, or FTP URLs.

    environment

    Environment variables to set on worker nodes

  2. new JavaSparkContext(master: String, appName: String, sparkHome: String, jars: Array[String])

    Permalink

    master

    Cluster URL to connect to (e.g. mesos://host:port, spark://host:port, local[4]).

    appName

    A name for your application, to display on the cluster web UI

    sparkHome

    The SPARK_HOME directory on the slave nodes

    jars

    Collection of JARs to send to the cluster. These can be paths on the local file system or HDFS, HTTP, HTTPS, or FTP URLs.

  3. new JavaSparkContext(master: String, appName: String, sparkHome: String, jarFile: String)

    Permalink

    master

    Cluster URL to connect to (e.g. mesos://host:port, spark://host:port, local[4]).

    appName

    A name for your application, to display on the cluster web UI

    sparkHome

    The SPARK_HOME directory on the slave nodes

    jarFile

    JAR file to send to the cluster. This can be a path on the local file system or an HDFS, HTTP, HTTPS, or FTP URL.

  4. new JavaSparkContext(master: String, appName: String, conf: SparkConf)

    Permalink

    master

    Cluster URL to connect to (e.g. mesos://host:port, spark://host:port, local[4]).

    appName

    A name for your application, to display on the cluster web UI

    conf

    a org.apache.spark.SparkConf object specifying other Spark parameters

  5. new JavaSparkContext(master: String, appName: String)

    Permalink

    master

    Cluster URL to connect to (e.g. mesos://host:port, spark://host:port, local[4]).

    appName

    A name for your application, to display on the cluster web UI

  6. new JavaSparkContext(conf: SparkConf)

    Permalink

    conf

    a org.apache.spark.SparkConf object specifying Spark parameters

  7. new JavaSparkContext()

    Permalink

    Create a JavaSparkContext that loads settings from system properties (for instance, when launching with ./bin/spark-submit).

  8. new JavaSparkContext(sc: SparkContext)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addFile(path: String, recursive: Boolean): Unit

    Permalink

    Add a file to be downloaded with this Spark job on every node.

    Add a file to be downloaded with this Spark job on every node. The path passed can be either a local file, a file in HDFS (or other Hadoop-supported filesystems), or an HTTP, HTTPS or FTP URI. To access the file in Spark jobs, use SparkFiles.get(fileName) to find its download location.

    A directory can be given if the recursive option is set to true. Currently directories are only supported for Hadoop-supported filesystems.

    Note

    A path can be added only once. Subsequent additions of the same path are ignored.

  5. def addFile(path: String): Unit

    Permalink

    Add a file to be downloaded with this Spark job on every node.

    Add a file to be downloaded with this Spark job on every node. The path passed can be either a local file, a file in HDFS (or other Hadoop-supported filesystems), or an HTTP, HTTPS or FTP URI. To access the file in Spark jobs, use SparkFiles.get(fileName) to find its download location.

    Note

    A path can be added only once. Subsequent additions of the same path are ignored.

  6. def addJar(path: String): Unit

    Permalink

    Adds a JAR dependency for all tasks to be executed on this SparkContext in the future.

    Adds a JAR dependency for all tasks to be executed on this SparkContext in the future. The path passed can be either a local file, a file in HDFS (or other Hadoop-supported filesystems), or an HTTP, HTTPS or FTP URI.

    Note

    A path can be added only once. Subsequent additions of the same path are ignored.

  7. def appName: String

    Permalink
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def binaryFiles(path: String): JavaPairRDD[String, PortableDataStream]

    Permalink

    Read a directory of binary files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI as a byte array.

    Read a directory of binary files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI as a byte array. Each file is read as a single record and returned in a key-value pair, where the key is the path of each file, the value is the content of each file.

    For example, if you have the following files:

    hdfs://a-hdfs-path/part-00000
    hdfs://a-hdfs-path/part-00001
    ...
    hdfs://a-hdfs-path/part-nnnnn

    Do

    JavaPairRDD<String, byte[]> rdd = sparkContext.dataStreamFiles("hdfs://a-hdfs-path")

    ,

    then rdd contains

    (a-hdfs-path/part-00000, its content)
    (a-hdfs-path/part-00001, its content)
    ...
    (a-hdfs-path/part-nnnnn, its content)
    Note

    Small files are preferred; very large files but may cause bad performance.

  10. def binaryFiles(path: String, minPartitions: Int): JavaPairRDD[String, PortableDataStream]

    Permalink

    Read a directory of binary files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI as a byte array.

    Read a directory of binary files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI as a byte array. Each file is read as a single record and returned in a key-value pair, where the key is the path of each file, the value is the content of each file.

    For example, if you have the following files:

    hdfs://a-hdfs-path/part-00000
    hdfs://a-hdfs-path/part-00001
    ...
    hdfs://a-hdfs-path/part-nnnnn

    Do

    JavaPairRDD<String, byte[]> rdd = sparkContext.dataStreamFiles("hdfs://a-hdfs-path")

    then rdd contains

    (a-hdfs-path/part-00000, its content)
    (a-hdfs-path/part-00001, its content)
    ...
    (a-hdfs-path/part-nnnnn, its content)
    minPartitions

    A suggestion value of the minimal splitting number for input data.

    Note

    Small files are preferred; very large files but may cause bad performance.

  11. def binaryRecords(path: String, recordLength: Int): JavaRDD[Array[Byte]]

    Permalink

    Load data from a flat binary file, assuming the length of each record is constant.

    Load data from a flat binary file, assuming the length of each record is constant.

    path

    Directory to the input data files

    returns

    An RDD of data with values, represented as byte arrays

  12. def broadcast[T](value: T): Broadcast[T]

    Permalink

    Broadcast a read-only variable to the cluster, returning a org.apache.spark.broadcast.Broadcast object for reading it in distributed functions.

    Broadcast a read-only variable to the cluster, returning a org.apache.spark.broadcast.Broadcast object for reading it in distributed functions. The variable will be sent to each cluster only once.

  13. def cancelAllJobs(): Unit

    Permalink

    Cancel all jobs that have been scheduled or are running.

  14. def cancelJobGroup(groupId: String): Unit

    Permalink

    Cancel active jobs for the specified group.

    Cancel active jobs for the specified group. See org.apache.spark.api.java.JavaSparkContext.setJobGroup for more information.

  15. def checkpointFile[T](path: String): JavaRDD[T]

    Permalink
    Attributes
    protected
  16. def clearCallSite(): Unit

    Permalink

    Pass-through to SparkContext.setCallSite.

    Pass-through to SparkContext.setCallSite. For API support only.

  17. def clearJobGroup(): Unit

    Permalink

    Clear the current thread's job group ID and its description.

  18. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. def close(): Unit

    Permalink
    Definition Classes
    JavaSparkContext → Closeable → AutoCloseable
  20. def defaultMinPartitions: Integer

    Permalink

    Default min number of partitions for Hadoop RDDs when not given by user

  21. def defaultParallelism: Integer

    Permalink

    Default level of parallelism to use when not given by user (e.g.

    Default level of parallelism to use when not given by user (e.g. parallelize and makeRDD).

  22. def emptyRDD[T]: JavaRDD[T]

    Permalink

    Get an RDD that has no partitions or elements.

  23. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  25. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. def getCheckpointDir: Optional[String]

    Permalink
  27. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  28. def getConf: SparkConf

    Permalink

    Return a copy of this JavaSparkContext's configuration.

    Return a copy of this JavaSparkContext's configuration. The configuration cannot be changed at runtime.

  29. def getLocalProperty(key: String): String

    Permalink

    Get a local property set in this thread, or null if it is missing.

    Get a local property set in this thread, or null if it is missing. See org.apache.spark.api.java.JavaSparkContext.setLocalProperty.

  30. def getPersistentRDDs: Map[Integer, JavaRDD[_]]

    Permalink

    Returns a Java map of JavaRDDs that have marked themselves as persistent via cache() call.

    Returns a Java map of JavaRDDs that have marked themselves as persistent via cache() call.

    Note

    This does not necessarily mean the caching or computation was successful.

  31. def getSparkHome(): Optional[String]

    Permalink

    Get Spark's home location from either a value set through the constructor, or the spark.home Java property, or the SPARK_HOME environment variable (in that order of preference).

    Get Spark's home location from either a value set through the constructor, or the spark.home Java property, or the SPARK_HOME environment variable (in that order of preference). If neither of these is set, return None.

  32. def hadoopConfiguration(): Configuration

    Permalink

    Returns the Hadoop configuration used for the Hadoop code (e.g.

    Returns the Hadoop configuration used for the Hadoop code (e.g. file systems) we reuse.

    Note

    As it will be reused in all Hadoop RDDs, it's better not to modify it unless you plan to set some global configurations for all Hadoop RDDs.

  33. def hadoopFile[K, V, F <: InputFormat[K, V]](path: String, inputFormatClass: Class[F], keyClass: Class[K], valueClass: Class[V]): JavaPairRDD[K, V]

    Permalink

    Get an RDD for a Hadoop file with an arbitrary InputFormat

    Get an RDD for a Hadoop file with an arbitrary InputFormat

    Note

    Because Hadoop's RecordReader class re-uses the same Writable object for each record, directly caching the returned RDD will create many references to the same object. If you plan to directly cache Hadoop writable objects, you should first copy them using a map function.

  34. def hadoopFile[K, V, F <: InputFormat[K, V]](path: String, inputFormatClass: Class[F], keyClass: Class[K], valueClass: Class[V], minPartitions: Int): JavaPairRDD[K, V]

    Permalink

    Get an RDD for a Hadoop file with an arbitrary InputFormat.

    Get an RDD for a Hadoop file with an arbitrary InputFormat.

    Note

    Because Hadoop's RecordReader class re-uses the same Writable object for each record, directly caching the returned RDD will create many references to the same object. If you plan to directly cache Hadoop writable objects, you should first copy them using a map function.

  35. def hadoopRDD[K, V, F <: InputFormat[K, V]](conf: JobConf, inputFormatClass: Class[F], keyClass: Class[K], valueClass: Class[V]): JavaPairRDD[K, V]

    Permalink

    Get an RDD for a Hadoop-readable dataset from a Hadoop JobConf giving its InputFormat and any other necessary info (e.g.

    Get an RDD for a Hadoop-readable dataset from a Hadoop JobConf giving its InputFormat and any other necessary info (e.g. file name for a filesystem-based dataset, table name for HyperTable,

    conf

    JobConf for setting up the dataset. Note: This will be put into a Broadcast. Therefore if you plan to reuse this conf to create multiple RDDs, you need to make sure you won't modify the conf. A safe approach is always creating a new conf for a new RDD.

    inputFormatClass

    Class of the InputFormat

    keyClass

    Class of the keys

    valueClass

    Class of the values

    Note

    Because Hadoop's RecordReader class re-uses the same Writable object for each record, directly caching the returned RDD will create many references to the same object. If you plan to directly cache Hadoop writable objects, you should first copy them using a map function.

  36. def hadoopRDD[K, V, F <: InputFormat[K, V]](conf: JobConf, inputFormatClass: Class[F], keyClass: Class[K], valueClass: Class[V], minPartitions: Int): JavaPairRDD[K, V]

    Permalink

    Get an RDD for a Hadoop-readable dataset from a Hadoop JobConf giving its InputFormat and any other necessary info (e.g.

    Get an RDD for a Hadoop-readable dataset from a Hadoop JobConf giving its InputFormat and any other necessary info (e.g. file name for a filesystem-based dataset, table name for HyperTable, etc).

    conf

    JobConf for setting up the dataset. Note: This will be put into a Broadcast. Therefore if you plan to reuse this conf to create multiple RDDs, you need to make sure you won't modify the conf. A safe approach is always creating a new conf for a new RDD.

    inputFormatClass

    Class of the InputFormat

    keyClass

    Class of the keys

    valueClass

    Class of the values

    minPartitions

    Minimum number of Hadoop Splits to generate.

    Note

    Because Hadoop's RecordReader class re-uses the same Writable object for each record, directly caching the returned RDD will create many references to the same object. If you plan to directly cache Hadoop writable objects, you should first copy them using a map function.

  37. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  38. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  39. def isLocal: Boolean

    Permalink
  40. def jars: List[String]

    Permalink
  41. def master: String

    Permalink
  42. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  43. def newAPIHadoopFile[K, V, F <: InputFormat[K, V]](path: String, fClass: Class[F], kClass: Class[K], vClass: Class[V], conf: Configuration): JavaPairRDD[K, V]

    Permalink

    Get an RDD for a given Hadoop file with an arbitrary new API InputFormat and extra configuration options to pass to the input format.

    Get an RDD for a given Hadoop file with an arbitrary new API InputFormat and extra configuration options to pass to the input format.

    Note

    Because Hadoop's RecordReader class re-uses the same Writable object for each record, directly caching the returned RDD will create many references to the same object. If you plan to directly cache Hadoop writable objects, you should first copy them using a map function.

  44. def newAPIHadoopRDD[K, V, F <: InputFormat[K, V]](conf: Configuration, fClass: Class[F], kClass: Class[K], vClass: Class[V]): JavaPairRDD[K, V]

    Permalink

    Get an RDD for a given Hadoop file with an arbitrary new API InputFormat and extra configuration options to pass to the input format.

    Get an RDD for a given Hadoop file with an arbitrary new API InputFormat and extra configuration options to pass to the input format.

    conf

    Configuration for setting up the dataset. Note: This will be put into a Broadcast. Therefore if you plan to reuse this conf to create multiple RDDs, you need to make sure you won't modify the conf. A safe approach is always creating a new conf for a new RDD.

    fClass

    Class of the InputFormat

    kClass

    Class of the keys

    vClass

    Class of the values

    Note

    Because Hadoop's RecordReader class re-uses the same Writable object for each record, directly caching the returned RDD will create many references to the same object. If you plan to directly cache Hadoop writable objects, you should first copy them using a map function.

  45. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  46. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  47. def objectFile[T](path: String): JavaRDD[T]

    Permalink

    Load an RDD saved as a SequenceFile containing serialized objects, with NullWritable keys and BytesWritable values that contain a serialized partition.

    Load an RDD saved as a SequenceFile containing serialized objects, with NullWritable keys and BytesWritable values that contain a serialized partition. This is still an experimental storage format and may not be supported exactly as is in future Spark releases. It will also be pretty slow if you use the default serializer (Java serialization), though the nice thing about it is that there's very little effort required to save arbitrary objects.

  48. def objectFile[T](path: String, minPartitions: Int): JavaRDD[T]

    Permalink

    Load an RDD saved as a SequenceFile containing serialized objects, with NullWritable keys and BytesWritable values that contain a serialized partition.

    Load an RDD saved as a SequenceFile containing serialized objects, with NullWritable keys and BytesWritable values that contain a serialized partition. This is still an experimental storage format and may not be supported exactly as is in future Spark releases. It will also be pretty slow if you use the default serializer (Java serialization), though the nice thing about it is that there's very little effort required to save arbitrary objects.

  49. def parallelize[T](list: List[T]): JavaRDD[T]

    Permalink

    Distribute a local Scala collection to form an RDD.

  50. def parallelize[T](list: List[T], numSlices: Int): JavaRDD[T]

    Permalink

    Distribute a local Scala collection to form an RDD.

  51. def parallelizeDoubles(list: List[Double]): JavaDoubleRDD

    Permalink

    Distribute a local Scala collection to form an RDD.

  52. def parallelizeDoubles(list: List[Double], numSlices: Int): JavaDoubleRDD

    Permalink

    Distribute a local Scala collection to form an RDD.

  53. def parallelizePairs[K, V](list: List[(K, V)]): JavaPairRDD[K, V]

    Permalink

    Distribute a local Scala collection to form an RDD.

  54. def parallelizePairs[K, V](list: List[(K, V)], numSlices: Int): JavaPairRDD[K, V]

    Permalink

    Distribute a local Scala collection to form an RDD.

  55. val sc: SparkContext

    Permalink
  56. def sequenceFile[K, V](path: String, keyClass: Class[K], valueClass: Class[V]): JavaPairRDD[K, V]

    Permalink

    Get an RDD for a Hadoop SequenceFile.

    Get an RDD for a Hadoop SequenceFile.

    Note

    Because Hadoop's RecordReader class re-uses the same Writable object for each record, directly caching the returned RDD will create many references to the same object. If you plan to directly cache Hadoop writable objects, you should first copy them using a map function.

  57. def sequenceFile[K, V](path: String, keyClass: Class[K], valueClass: Class[V], minPartitions: Int): JavaPairRDD[K, V]

    Permalink

    Get an RDD for a Hadoop SequenceFile with given key and value types.

    Get an RDD for a Hadoop SequenceFile with given key and value types.

    Note

    Because Hadoop's RecordReader class re-uses the same Writable object for each record, directly caching the returned RDD will create many references to the same object. If you plan to directly cache Hadoop writable objects, you should first copy them using a map function.

  58. def setCallSite(site: String): Unit

    Permalink

    Pass-through to SparkContext.setCallSite.

    Pass-through to SparkContext.setCallSite. For API support only.

  59. def setCheckpointDir(dir: String): Unit

    Permalink

    Set the directory under which RDDs are going to be checkpointed.

    Set the directory under which RDDs are going to be checkpointed. The directory must be a HDFS path if running on a cluster.

  60. def setJobDescription(value: String): Unit

    Permalink

    Set a human readable description of the current job.

    Set a human readable description of the current job.

    Since

    2.3.0

  61. def setJobGroup(groupId: String, description: String): Unit

    Permalink

    Assigns a group ID to all the jobs started by this thread until the group ID is set to a different value or cleared.

    Assigns a group ID to all the jobs started by this thread until the group ID is set to a different value or cleared.

    See also

    setJobGroup(groupId: String, description: String, interruptThread: Boolean). This method sets interruptOnCancel to false.

  62. def setJobGroup(groupId: String, description: String, interruptOnCancel: Boolean): Unit

    Permalink

    Assigns a group ID to all the jobs started by this thread until the group ID is set to a different value or cleared.

    Assigns a group ID to all the jobs started by this thread until the group ID is set to a different value or cleared.

    Often, a unit of execution in an application consists of multiple Spark actions or jobs. Application programmers can use this method to group all those jobs together and give a group description. Once set, the Spark web UI will associate such jobs with this group.

    The application can also use org.apache.spark.api.java.JavaSparkContext.cancelJobGroup to cancel all running jobs in this group. For example,

    // In the main thread:
    sc.setJobGroup("some_job_to_cancel", "some job description");
    rdd.map(...).count();
    
    // In a separate thread:
    sc.cancelJobGroup("some_job_to_cancel");

    If interruptOnCancel is set to true for the job group, then job cancellation will result in Thread.interrupt() being called on the job's executor threads. This is useful to help ensure that the tasks are actually stopped in a timely manner, but is off by default due to HDFS-1208, where HDFS may respond to Thread.interrupt() by marking nodes as dead.

  63. def setLocalProperty(key: String, value: String): Unit

    Permalink

    Set a local property that affects jobs submitted from this thread, and all child threads, such as the Spark fair scheduler pool.

    Set a local property that affects jobs submitted from this thread, and all child threads, such as the Spark fair scheduler pool.

    These properties are inherited by child threads spawned from this thread. This may have unexpected consequences when working with thread pools. The standard java implementation of thread pools have worker threads spawn other worker threads. As a result, local properties may propagate unpredictably.

  64. def setLogLevel(logLevel: String): Unit

    Permalink

    Control our logLevel.

    Control our logLevel. This overrides any user-defined log settings.

    logLevel

    The desired log level as a string. Valid log levels include: ALL, DEBUG, ERROR, FATAL, INFO, OFF, TRACE, WARN

  65. def sparkUser: String

    Permalink
  66. def startTime: Long

    Permalink
  67. def statusTracker: JavaSparkStatusTracker

    Permalink
  68. def stop(): Unit

    Permalink

    Shut down the SparkContext.

  69. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  70. def textFile(path: String, minPartitions: Int): JavaRDD[String]

    Permalink

    Read a text file from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI, and return it as an RDD of Strings.

  71. def textFile(path: String): JavaRDD[String]

    Permalink

    Read a text file from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI, and return it as an RDD of Strings.

  72. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  73. def union(first: JavaDoubleRDD, rest: List[JavaDoubleRDD]): JavaDoubleRDD

    Permalink

    Build the union of two or more RDDs.

    Build the union of two or more RDDs.

    Definition Classes
    JavaSparkContext → JavaSparkContextVarargsWorkaround
  74. def union[K, V](first: JavaPairRDD[K, V], rest: List[JavaPairRDD[K, V]]): JavaPairRDD[K, V]

    Permalink

    Build the union of two or more RDDs.

    Build the union of two or more RDDs.

    Definition Classes
    JavaSparkContext → JavaSparkContextVarargsWorkaround
  75. def union[T](first: JavaRDD[T], rest: List[JavaRDD[T]]): JavaRDD[T]

    Permalink

    Build the union of two or more RDDs.

    Build the union of two or more RDDs.

    Definition Classes
    JavaSparkContext → JavaSparkContextVarargsWorkaround
  76. final def union[K, V](rdds: <repeated...>[JavaPairRDD[K, V]]): JavaPairRDD[K, V]

    Permalink
    Definition Classes
    JavaSparkContextVarargsWorkaround
  77. def union(rdds: <repeated...>[JavaDoubleRDD]): JavaDoubleRDD

    Permalink
    Definition Classes
    JavaSparkContextVarargsWorkaround
  78. final def union[T](rdds: <repeated...>[JavaRDD[T]]): JavaRDD[T]

    Permalink
    Definition Classes
    JavaSparkContextVarargsWorkaround
  79. def version: String

    Permalink

    The version of Spark on which this application is running.

  80. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  81. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  82. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  83. def wholeTextFiles(path: String): JavaPairRDD[String, String]

    Permalink

    Read a directory of text files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI.

    Read a directory of text files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI. Each file is read as a single record and returned in a key-value pair, where the key is the path of each file, the value is the content of each file.

    See also

    wholeTextFiles(path: String, minPartitions: Int).

  84. def wholeTextFiles(path: String, minPartitions: Int): JavaPairRDD[String, String]

    Permalink

    Read a directory of text files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI.

    Read a directory of text files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI. Each file is read as a single record and returned in a key-value pair, where the key is the path of each file, the value is the content of each file.

    For example, if you have the following files:

    hdfs://a-hdfs-path/part-00000
    hdfs://a-hdfs-path/part-00001
    ...
    hdfs://a-hdfs-path/part-nnnnn

    Do

    JavaPairRDD<String, String> rdd = sparkContext.wholeTextFiles("hdfs://a-hdfs-path")

    then rdd contains

    (a-hdfs-path/part-00000, its content)
    (a-hdfs-path/part-00001, its content)
    ...
    (a-hdfs-path/part-nnnnn, its content)
    minPartitions

    A suggestion value of the minimal splitting number for input data.

    Note

    Small files are preferred, large file is also allowable, but may cause bad performance.

Deprecated Value Members

  1. def accumulable[T, R](initialValue: T, name: String, param: AccumulableParam[T, R]): Accumulable[T, R]

    Permalink

    Create an org.apache.spark.Accumulable shared variable of the given type, to which tasks can "add" values with add.

    Create an org.apache.spark.Accumulable shared variable of the given type, to which tasks can "add" values with add. Only the master can access the accumulable's value.

    This version supports naming the accumulator for display in Spark's web UI.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use AccumulatorV2

  2. def accumulable[T, R](initialValue: T, param: AccumulableParam[T, R]): Accumulable[T, R]

    Permalink

    Create an org.apache.spark.Accumulable shared variable of the given type, to which tasks can "add" values with add.

    Create an org.apache.spark.Accumulable shared variable of the given type, to which tasks can "add" values with add. Only the master can access the accumulable's value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use AccumulatorV2

  3. def accumulator[T](initialValue: T, name: String, accumulatorParam: AccumulatorParam[T]): Accumulator[T]

    Permalink

    Create an org.apache.spark.Accumulator variable of a given type, which tasks can "add" values to using the add method.

    Create an org.apache.spark.Accumulator variable of a given type, which tasks can "add" values to using the add method. Only the master can access the accumulator's value.

    This version supports naming the accumulator for display in Spark's web UI.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use AccumulatorV2

  4. def accumulator[T](initialValue: T, accumulatorParam: AccumulatorParam[T]): Accumulator[T]

    Permalink

    Create an org.apache.spark.Accumulator variable of a given type, which tasks can "add" values to using the add method.

    Create an org.apache.spark.Accumulator variable of a given type, which tasks can "add" values to using the add method. Only the master can access the accumulator's value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use AccumulatorV2

  5. def accumulator(initialValue: Double, name: String): Accumulator[Double]

    Permalink

    Create an org.apache.spark.Accumulator double variable, which tasks can "add" values to using the add method.

    Create an org.apache.spark.Accumulator double variable, which tasks can "add" values to using the add method. Only the master can access the accumulator's value.

    This version supports naming the accumulator for display in Spark's web UI.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use sc().doubleAccumulator(String)

  6. def accumulator(initialValue: Double): Accumulator[Double]

    Permalink

    Create an org.apache.spark.Accumulator double variable, which tasks can "add" values to using the add method.

    Create an org.apache.spark.Accumulator double variable, which tasks can "add" values to using the add method. Only the master can access the accumulator's value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use sc().doubleAccumulator()

  7. def accumulator(initialValue: Int, name: String): Accumulator[Integer]

    Permalink

    Create an org.apache.spark.Accumulator integer variable, which tasks can "add" values to using the add method.

    Create an org.apache.spark.Accumulator integer variable, which tasks can "add" values to using the add method. Only the master can access the accumulator's value.

    This version supports naming the accumulator for display in Spark's web UI.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use sc().longAccumulator(String)

  8. def accumulator(initialValue: Int): Accumulator[Integer]

    Permalink

    Create an org.apache.spark.Accumulator integer variable, which tasks can "add" values to using the add method.

    Create an org.apache.spark.Accumulator integer variable, which tasks can "add" values to using the add method. Only the master can access the accumulator's value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use sc().longAccumulator()

  9. def doubleAccumulator(initialValue: Double, name: String): Accumulator[Double]

    Permalink

    Create an org.apache.spark.Accumulator double variable, which tasks can "add" values to using the add method.

    Create an org.apache.spark.Accumulator double variable, which tasks can "add" values to using the add method. Only the master can access the accumulator's value.

    This version supports naming the accumulator for display in Spark's web UI.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use sc().doubleAccumulator(String)

  10. def doubleAccumulator(initialValue: Double): Accumulator[Double]

    Permalink

    Create an org.apache.spark.Accumulator double variable, which tasks can "add" values to using the add method.

    Create an org.apache.spark.Accumulator double variable, which tasks can "add" values to using the add method. Only the master can access the accumulator's value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use sc().doubleAccumulator()

  11. def intAccumulator(initialValue: Int, name: String): Accumulator[Integer]

    Permalink

    Create an org.apache.spark.Accumulator integer variable, which tasks can "add" values to using the add method.

    Create an org.apache.spark.Accumulator integer variable, which tasks can "add" values to using the add method. Only the master can access the accumulator's value.

    This version supports naming the accumulator for display in Spark's web UI.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use sc().longAccumulator(String)

  12. def intAccumulator(initialValue: Int): Accumulator[Integer]

    Permalink

    Create an org.apache.spark.Accumulator integer variable, which tasks can "add" values to using the add method.

    Create an org.apache.spark.Accumulator integer variable, which tasks can "add" values to using the add method. Only the master can access the accumulator's value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use sc().longAccumulator()

Inherited from Closeable

Inherited from AutoCloseable

Inherited from JavaSparkContextVarargsWorkaround

Inherited from AnyRef

Inherited from Any

Ungrouped