Mirror of Apache Spark
Scala Java Python R Shell JavaScript Other
Switch branches/tags
v0.9.0-incubating v0.8.1-incubating v0.8.0-incubating v0.8.0-incubating-rc3 v0.7.2 v0.7.1 v0.7.0 v0.7.0-bizo-1 v0.6.2 v0.6.1 v0.6.0 v0.6.0-yarn v0.5.2 v0.5.1 v0.5.0 spark-parent_2.11-1.6.3-csd-7 spark-parent_2.11-1.6.3-csd-6 spark-parent_2.11-1.6.3-csd-5 spark-parent_2.11-1.6.3-csd-4 spark-parent_2.11-1.6.3-csd-3 spark-parent_2.11-1.6.3-csd-2 spark-parent_2.11-1.6.3-csd-1 spark-parent_2.11-1.6.2-csd-6 spark-parent_2.11-1.6.2-csd-5 spark-parent_2.11-1.6.2-csd-4 spark-parent_2.11-1.6.2-csd-3 spark-parent_2.11-1.6.2-csd-2 spark-parent_2.11-1.6.2-csd-1 spark-parent_2.10-1.6.1-csd-9 spark-parent_2.10-1.6.1-csd-8 spark-parent_2.10-1.6.1-csd-7 spark-parent_2.10-1.6.1-csd-6 spark-parent_2.10-1.6.1-csd-5 spark-parent_2.10-1.6.1-csd-4 spark-parent_2.10-1.6.1-csd-3 spark-parent_2.10-1.6.1-csd-2 spark-parent_2.10-1.6.1-csd-1 spark-parent_2.10-1.6.0-csd-12 spark-parent_2.10-1.6.0-csd-11 spark-parent_2.10-1.6.0-csd-10 spark-parent_2.10-1.6.0-csd-9 spark-parent_2.10-1.6.0-csd-8 spark-parent_2.10-1.6.0-csd-7 spark-parent_2.10-1.6.0-csd-6 spark-parent_2.10-1.6.0-csd-5 spark-parent_2.10-1.6.0-csd-4 spark-parent_2.10-1.6.0-csd-3 spark-parent_2.10-1.6.0-csd-2 spark-parent_2.10-1.6.0-csd-1 spark-parent_2.10-1.5.2-csd-7 spark-parent_2.10-1.5.2-csd-6 spark-parent_2.10-1.5.2-csd-5 spark-parent_2.10-1.5.2-csd-4 spark-parent_2.10-1.5.2-csd-3 spark-parent_2.10-1.5.2-csd-2 spark-parent_2.10-1.5.2-csd-1 spark-parent_2.10-1.5.1-csd-10 spark-parent_2.10-1.5.1-csd-9 spark-parent_2.10-1.5.1-csd-8 spark-parent_2.10-1.5.1-csd-7 spark-parent_2.10-1.5.1-csd-6 spark-parent_2.10-1.5.1-csd-5 spark-parent_2.10-1.5.1-csd-4 spark-parent_2.10-1.5.1-csd-3 spark-parent_2.10-1.5.1-csd-2 spark-parent_2.10-1.5.1-csd-1 spark-parent_2.10-1.5.0-csd-14 spark-parent_2.10-1.5.0-csd-13 spark-parent_2.10-1.5.0-csd-12 spark-parent_2.10-1.5.0-csd-11 spark-parent_2.10-1.5.0-csd-10 spark-parent_2.10-1.5.0-csd-9 spark-parent_2.10-1.5.0-csd-8 spark-parent_2.10-1.5.0-csd-7 spark-parent_2.10-1.5.0-csd-6 spark-parent_2.10-1.5.0-csd-5 spark-parent_2.10-1.5.0-csd-4 spark-parent_2.10-1.5.0-csd-3 spark-parent_2.10-1.5.0-csd-2 spark-parent_2.10-1.5.0-csd-1 spark-parent_2.10-1.4.1-csd-13 spark-parent_2.10-1.4.1-csd-12 spark-parent_2.10-1.4.1-csd-11 spark-parent_2.10-1.4.1-csd-10 spark-parent_2.10-1.4.1-csd-9 spark-parent_2.10-1.4.1-csd-8 spark-parent_2.10-1.4.1-csd-7 spark-parent_2.10-1.4.1-csd-6 spark-parent_2.10-1.4.1-csd-5 spark-parent_2.10-1.4.1-csd-4 spark-parent_2.10-1.4.1-csd-3 spark-parent_2.10-1.4.1-csd-2 spark-parent_2.10-1.4.1-csd-1 spark-parent_2.10-1.4.0-csd-4 spark-parent_2.10-1.4.0-csd-3 spark-parent_2.10-1.4.0-csd-2 spark-parent_2.10-1.4.0-csd-1 spark-parent-1.2.2-csd-10 spark-parent-1.2.2-csd-9 spark-parent-1.2.2-csd-8
Nothing to show
Pull request Compare This branch is 1188 commits ahead, 5978 commits behind apache:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
R Preparing development version 1.6.4-SNAPSHOT Nov 2, 2016
bagel [maven-release-plugin] prepare for next development iteration Apr 21, 2017
bin [SPARK-15761][MLLIB][PYSPARK] Load ipython when default python is Pyt… Jul 1, 2016
build [MINOR][BUILD] Download Maven 3.3.9 instead of 3.3.3 because the latt… Jul 6, 2016
conf [SPARK-11242][SQL] In conf/spark-env.sh.template SPARK_DRIVER_MEMORY … Oct 22, 2015
core [maven-release-plugin] prepare for next development iteration Apr 21, 2017
dev [SPARK-17378][HOTFIX] Upgrade snappy-java to -- fix Hadoop 1 … Sep 7, 2016
docker [SPARK-11491] Update build to use Scala 2.10.5 Nov 5, 2015
docs Merge branch 'branch-1.6' of github.com:apache/spark into csd-1.6 Oct 17, 2016
ec2 [SPARK-16257][BUILD] Update spark_ec2.py to support Spark 1.6.2 and 1… Jun 30, 2016
examples [maven-release-plugin] prepare for next development iteration Apr 21, 2017
external [maven-release-plugin] prepare for next development iteration Apr 21, 2017
graphx [maven-release-plugin] prepare for next development iteration Apr 21, 2017
licenses [SPARK-10833] [BUILD] Inline, organize BSD/MIT licenses in LICENSE Sep 29, 2015
project [SPARK-16353][BUILD][DOC] Missing javadoc options for java unidoc Jul 4, 2016
python [SPARK-17003][BUILD][BRANCH-1.6] release-build.sh is missing hive-thr… Aug 12, 2016
repl [maven-release-plugin] prepare for next development iteration Apr 21, 2017
sbin [SPARK-11218][CORE] show help messages for start-slave and start-master Nov 9, 2015
sql [maven-release-plugin] prepare for next development iteration Apr 21, 2017
streaming [maven-release-plugin] prepare for next development iteration Apr 21, 2017
unsafe [maven-release-plugin] prepare for next development iteration Apr 21, 2017
yarn [maven-release-plugin] prepare for next development iteration Apr 21, 2017
.gitattributes [SPARK-3870] EOL character enforcement Oct 31, 2014
.gitignore [SPARK-11717] Ignore R session and history files from git Nov 18, 2015
.rat-excludes [SPARK-10359][PROJECT-INFRA] Backport dev/test-dependencies script to… Jan 10, 2016
CHANGES.txt Update CHANGES.txt and spark-ec2 and R package versions for 1.6.1 Feb 27, 2016
CONTRIBUTING.md [SPARK-6889] [DOCS] CONTRIBUTING.md updates to accompany contribution… Apr 22, 2015
LICENSE [SPARK-11491] Update build to use Scala 2.10.5 Nov 5, 2015
README.md [SPARK-11305][DOCS] Remove Third-Party Hadoop Distributions Doc Page Nov 1, 2015
pom.xml [maven-release-plugin] prepare for next development iteration Apr 21, 2017
pylintrc [SPARK-9116] [SQL] [PYSPARK] support Python only UDT in __main__ Jul 30, 2015
scalastyle-config.xml Revert "[SPARK-12365][CORE] Use ShutdownHookManager where Runtime.get… Dec 18, 2015
tox.ini [SPARK-7427] [PYSPARK] Make sharedParams match in Scala, Python May 11, 2015


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.