Cluster URL to connect to (e.g. mesos://host:port, spark://host:port, local[4]).
A name for your application, to display on the cluster web UI
The SPARK_HOME directory on the slave nodes
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 variables to set on worker nodes
Cluster URL to connect to (e.g. mesos://host:port, spark://host:port, local[4]).
A name for your application, to display on the cluster web UI
The SPARK_HOME directory on the slave nodes
Collection of JARs to send to the cluster. These can be paths on the local file system or HDFS, HTTP, HTTPS, or FTP URLs.
Cluster URL to connect to (e.g. mesos://host:port, spark://host:port, local[4]).
A name for your application, to display on the cluster web UI
The SPARK_HOME directory on the slave nodes
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.
Cluster URL to connect to (e.g. mesos://host:port, spark://host:port, local[4]).
A name for your application, to display on the cluster web UI
a org.apache.spark.SparkConf object specifying other Spark parameters
Cluster URL to connect to (e.g. mesos://host:port, spark://host:port, local[4]).
A name for your application, to display on the cluster web UI
a org.apache.spark.SparkConf object specifying Spark parameters
Create a JavaSparkContext that loads settings from system properties (for instance, when launching with ./bin/spark-submit).
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.
A path can be added only once. Subsequent additions of the same path are ignored.
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 path can be added only once. Subsequent additions of the same path are ignored.
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.
A path can be added only once. Subsequent additions of the same path are ignored.
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)
Small files are preferred; very large files but may cause bad performance.
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)
A suggestion value of the minimal splitting number for input data.
Small files are preferred; very large files but may cause bad performance.
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.
Directory to the input data files
An RDD of data with values, represented as byte arrays
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.
Cancel all jobs that have been scheduled or are running.
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.
Pass-through to SparkContext.setCallSite.
Pass-through to SparkContext.setCallSite. For API support only.
Clear the current thread's job group ID and its description.
Default min number of partitions for Hadoop RDDs when not given by user
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).
Get an RDD that has no partitions or elements.
Return a copy of this JavaSparkContext's configuration.
Return a copy of this JavaSparkContext's configuration. The configuration cannot be changed at runtime.
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
.
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.
This does not necessarily mean the caching or computation was successful.
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.
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.
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.
Get an RDD for a Hadoop file with an arbitrary InputFormat
Get an RDD for a Hadoop file with an arbitrary InputFormat
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.
Get an RDD for a Hadoop file with an arbitrary InputFormat.
Get an RDD for a Hadoop file with an arbitrary InputFormat.
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.
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,
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.
Class of the InputFormat
Class of the keys
Class of the values
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.
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).
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.
Class of the InputFormat
Class of the keys
Class of the values
Minimum number of Hadoop Splits to generate.
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.
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.
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.
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.
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.
Class of the InputFormat
Class of the keys
Class of the values
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.
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.
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.
Distribute a local Scala collection to form an RDD.
Distribute a local Scala collection to form an RDD.
Distribute a local Scala collection to form an RDD.
Distribute a local Scala collection to form an RDD.
Distribute a local Scala collection to form an RDD.
Distribute a local Scala collection to form an RDD.
Get an RDD for a Hadoop SequenceFile.
Get an RDD for a Hadoop SequenceFile.
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.
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.
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.
Pass-through to SparkContext.setCallSite.
Pass-through to SparkContext.setCallSite. For API support only.
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.
Set a human readable description of the current job.
Set a human readable description of the current job.
2.3.0
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.
setJobGroup(groupId: String, description: String, interruptThread: Boolean)
.
This method sets interruptOnCancel to false.
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.
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.
Control our logLevel.
Control our logLevel. This overrides any user-defined log settings.
The desired log level as a string. Valid log levels include: ALL, DEBUG, ERROR, FATAL, INFO, OFF, TRACE, WARN
Shut down the SparkContext.
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.
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.
Build the union of two or more RDDs.
Build the union of two or more RDDs.
Build the union of two or more RDDs.
Build the union of two or more RDDs.
Build the union of two or more RDDs.
Build the union of two or more RDDs.
The version of Spark on which this application is running.
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.
wholeTextFiles(path: String, minPartitions: Int)
.
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)
A suggestion value of the minimal splitting number for input data.
Small files are preferred, large file is also allowable, but may cause bad performance.
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.
(Since version 2.0.0) use AccumulatorV2
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
.
(Since version 2.0.0) use AccumulatorV2
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.
(Since version 2.0.0) use AccumulatorV2
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
.
(Since version 2.0.0) use AccumulatorV2
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.
(Since version 2.0.0) use sc().doubleAccumulator(String)
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
.
(Since version 2.0.0) use sc().doubleAccumulator()
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.
(Since version 2.0.0) use sc().longAccumulator(String)
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
.
(Since version 2.0.0) use sc().longAccumulator()
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.
(Since version 2.0.0) use sc().doubleAccumulator(String)
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
.
(Since version 2.0.0) use sc().doubleAccumulator()
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.
(Since version 2.0.0) use sc().longAccumulator(String)
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
.
(Since version 2.0.0) use sc().longAccumulator()
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.