spark README

The project's README from github.com/apache/spark. As one markdown file: README.md.

Apache Spark

Spark is a unified analytics engine for large-scale data processing. It provides high-level APIs in Scala, Java, Python, and R (Deprecated), 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, pandas API on Spark for pandas workloads, MLlib for machine learning, GraphX for graph processing, and Structured Streaming for stream processing.

License Maven Central Java GitHub Actions Build PySpark Coverage PyPI Downloads

Online Documentation

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

Build Pipeline Status

Branch Status
master GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
branch-4.x GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
branch-4.3 GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
branch-4.2 GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
branch-4.1 GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
branch-4.0 GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
GitHub Actions Build
branch-3.5 GitHub Actions Build
GitHub Actions Build
GitHub Actions Build

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".

For general development tips, including info on developing Spark using an IDE, see "Useful Developer Tools".

Interactive Scala Shell

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

./bin/spark-shell

Try the following command, which should return 1,000,000,000:

scala> spark.range(1000 * 1000 * 1000).count()

Interactive Python Shell

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

./bin/pyspark

And run the following command, which should also return 1,000,000,000:

>>> spark.range(1000 * 1000 * 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 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:

./dev/run-tests

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

There is also a Kubernetes integration test, see resource-managers/kubernetes/integration-tests/README.md

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 and Enabling YARN" for detailed guidance on building for a particular distribution of Hadoop, including building for particular Hive and Hive Thriftserver distributions.

Configuration

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

Contributing

Please review the Contribution to Spark guide for information on how to get started contributing to the project.

spark (apache/spark)

Searching Database…

44.2K ·GitHub
这是什么?Apache Spark 是一个用于大规模数据处理的统一分析引擎,在优化过的执行引擎之上,提供 Scala、Java、Python 和 R 的高级 API。
它是我写代码时调用的库,还是我自己运行的服务?它是一个你可以在上面构建应用的引擎,并附带更高层的工具:用于 SQL 和 DataFrame 的 Spark SQL、面向 pandas 工作负载的 pandas API、MLlib、GraphX 和 Structured Streaming。
我怎么才能看到它实际跑起来?获取一个官方发布版并运行自带的示例——Pi 示例是最经典的一个;很多示例在不带参数运行时会打印用法说明。
它访问 Hadoop 存储时有什么坑?有——它使用 Hadoop 核心库来访问 HDFS 和其他 Hadoop 支持的存储,而且你必须针对集群所运行的同一 Hadoop 版本来构建 Spark。
这需要一个完整的集群吗,还是我的笔记本就够了?笔记本就够——示例可以在本地用单线程运行,也可以用 local[N] 多线程运行。
那等我的笔记本不够用了,怎么让它指向真正的集群?运行示例时设置 MASTER 环境变量:spark:// 地址或 'yarn' 会把作业提交到集群。
R API 被标记为已弃用——我还应该用它开始新项目吗?README 把 R 列在高级 API 之中,但标注了 '(Deprecated)'(已弃用),所以新项目最好用 Scala、Java 或 Python。
Spark 能在 Kubernetes 上运行吗?能——仓库在 resource-managers/kubernetes 下包含 Kubernetes 集成,还有自己的 integration-tests README,不过主 README 只在测试相关的语境里提到它。
它支持 Hive 吗?支持——构建文档介绍了如何针对特定的 Hive 和 Hive Thriftserver 发行版进行构建,所以 Hive 支持取决于是否针对集群对应的发行版来构建 Spark。
What are similar projects?trino, BigData-Notes, flink, presto, doris, dask, xgboost, modin
Creator
apache
Size
610.5 MB
Stars
44.2K
Updated
CommitOct 17
Age
12y
Commits · 90 Days