Skip to content
Mirror of Apache Spark
Scala Java Python R Shell JavaScript Other
Find file
New pull request
Pull request Compare This branch is 13 commits behind apache:master.
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
R [SPARK-11781][SPARKR] SparkR has problem in inferring type of raw type.
assembly [SPARK-12023][BUILD] Fix warnings while packaging spark with maven.
bagel [SPARK-10300] [BUILD] [TESTS] Add support for test tags in
bin [SPARK-11880][WINDOWS][SPARK SUBMIT] bin/load-spark-env.cmd loads spa…
build [SPARK-11052] Spaces in the build dir causes failures in the build/mv…
conf [SPARK-11929][CORE] Make the repl log4j configuration override the ro…
core [SPARK-11821] Propagate Kerberos keytab for all environments
data/mllib [MLLIB] [DOC] Seed fix in mllib naive bayes example
dev [SPARK-12020][TESTS][TEST-HADOOP2.0] PR builder cannot trigger hadoop…
docker-integration-tests [SPARK-10186][SQL][FOLLOW-UP] simplify test
docker [SPARK-11491] Update build to use Scala 2.10.5
docs [SPARK-11821] Propagate Kerberos keytab for all environments
ec2 [SPARK-11991] fixes
examples [SPARK-11960][MLLIB][DOC] User guide for streaming tests
external [SPARK-12023][BUILD] Fix warnings while packaging spark with maven.
extras [SPARK-12046][DOC] Fixes various ScalaDoc/JavaDoc issues
graphx Fixed error in scaladoc of convertToCanonicalEdges
launcher [SPARK-11140][CORE] Transfer files using network lib when using Netty…
licenses [SPARK-10833] [BUILD] Inline, organize BSD/MIT licenses in LICENSE
mllib [SPARK-12046][DOC] Fixes various ScalaDoc/JavaDoc issues
network [SPARK-12007][NETWORK] Avoid copies in the network lib's RPC layer.
project [SPARK-12046][DOC] Fixes various ScalaDoc/JavaDoc issues
python [SPARK-12058][HOTFIX] Disable KinesisStreamTests
repl [SPARK-11929][CORE] Make the repl log4j configuration override the ro…
sbin [SPARK-11218][CORE] show help messages for start-slave and start-master
sbt Adde LICENSE Header to build/mvn, build/sbt and sbt/sbt
sql [SPARK-11905][SQL] Support Persist/Cache and Unpersist in Dataset APIs
streaming [SPARK-12046][DOC] Fixes various ScalaDoc/JavaDoc issues
tags [SPARK-9818] Re-enable Docker tests for JDBC data source
tools [SPARK-11732] Removes some MiMa false positives
unsafe [SPARK-11737] [SQL] Fix serialization of UTF8String with Kyro
yarn [SPARK-12046][DOC] Fixes various ScalaDoc/JavaDoc issues
.gitattributes [SPARK-3870] EOL character enforcement
.gitignore [MINOR][BUILD] Ignore ensime cache
.rat-excludes Revert "[SPARK-11206] Support SQL UI on the history server" [SPARK-6889] [DOCS] updates to accompany contribution…
LICENSE [SPARK-11491] Update build to use Scala 2.10.5
NOTICE [SPARK-10833] [BUILD] Inline, organize BSD/MIT licenses in LICENSE [SPARK-11305][DOCS] Remove Third-Party Hadoop Distributions Doc Page [SPARK-11903] Remove --skip-java-test
pom.xml [SPARK-4424] Remove spark.driver.allowMultipleContexts override in tests
pylintrc [SPARK-9116] [SQL] [PYSPARK] support Python only UDT in __main__
scalastyle-config.xml [SPARK-11615] Drop @VisibleForTesting annotation
tox.ini [SPARK-7427] [PYSPARK] Make sharedParams match in Scala, Python

Apache Spark

Spark is a fast and general cluster computing system for Big Data. It provides high-level APIs in Scala, Java, Python, and R, and an optimized engine that supports general computation graphs for data analysis. It also supports a rich set of higher-level tools including Spark SQL for SQL and DataFrames, MLlib for machine learning, GraphX for graph processing, and Spark Streaming for stream processing.

Online Documentation

You can find the latest Spark documentation, including a programming guide, on the project web page and project wiki. This README file only contains basic setup instructions.

Building Spark

Spark is built using Apache Maven. To build Spark and its example programs, run:

build/mvn -DskipTests clean package

(You do not need to do this if you downloaded a pre-built package.) More detailed documentation is available from the project site, at "Building Spark".

Interactive Scala Shell

The easiest way to start using Spark is through the Scala shell:


Try the following command, which should return 1000:

scala> sc.parallelize(1 to 1000).count()

Interactive Python Shell

Alternatively, if you prefer Python, you can use the Python shell:


And run the following command, which should also return 1000:

>>> sc.parallelize(range(1000)).count()

Example Programs

Spark also comes with several sample programs in the examples directory. To run one of them, use ./bin/run-example <class> [params]. For example:

./bin/run-example SparkPi

will run the Pi example locally.

You can set the MASTER environment variable when running examples to submit examples to a cluster. This can be a mesos:// or spark:// URL, "yarn" to run on YARN, and "local" to run locally with one thread, or "local[N]" to run locally with N threads. You can also use an abbreviated class name if the class is in the examples package. For instance:

MASTER=spark://host:7077 ./bin/run-example SparkPi

Many of the example programs print usage help if no params are given.

Running Tests

Testing first requires building Spark. Once Spark is built, tests can be run using:


Please see the guidance on how to run tests for a module, or individual tests.

A Note About Hadoop Versions

Spark uses the Hadoop core library to talk to HDFS and other Hadoop-supported storage systems. Because the protocols have changed in different versions of Hadoop, you must build Spark against the same version that your cluster runs.

Please refer to the build documentation at "Specifying the Hadoop Version" for detailed guidance on building for a particular distribution of Hadoop, including building for particular Hive and Hive Thriftserver distributions.


Please refer to the Configuration Guide in the online documentation for an overview on how to configure Spark.

Something went wrong with that request. Please try again.