Spark Connect Rust Client
A fast, native Rust client for Apache Spark Connect - and a drop-in
pyspark replacement with 100% public-API parity with PySpark 4.2.0. It
builds spark.connect protobuf plans, manages the gRPC channel, and decodes
Arrow results in Rust, speaking the same protocol and returning the same results
as the reference client.
📖 Documentation
Full documentation lives at apache.github.io/spark-connect-rust
- installation, quickstart, the DataFrame / Columns / SQL / Reading & Writing / Streaming / Catalog / Types API, Rust UDFs via WebAssembly, and the architecture.
Install
Python - a faster, drop-in replacement for the
pyspark-client PyPI package
(uninstall any existing pyspark / pyspark-client first):
pip install pyspark-client-rust
Your Spark Connect code then runs unchanged; use it exactly like PySpark.
Rust - the native crate:
[dependencies]
apache-spark-connect = "4.2"
Quickstart (Rust)
use spark_connect::{SparkSession, functions as f, lit};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let spark = SparkSession::builder()
.remote("sc://localhost:15002")
.get_or_create()?;
let df = spark
.range(1_000_000)?
.select([(f::col("id") * lit(2)).alias("x")])
.filter((f::col("x") % lit(3)).eq(lit(0)));
println!("count = {}", df.count()?);
df.show(20)?;
Ok(())
}
See the documentation for the full API, running a Spark Connect server, and more.
User-Defined Functions (UDFs)
Write UDFs as plain Rust functions and call them directly — #[spark_wasm_udf]
compiles them to WebAssembly and ships them to the executors:
#[spark_wasm_udf]
mod udfs {
pub fn add_one(x: i64) -> i64 { x + 1 }
}
spark.range(5)?.select([udf::add_one(col("id"))?]).show(20)?;
See the WASM UDF guide for the full setup, SQL registration, supported types, and more.
Contributing
Issues are tracked in ASF JIRA under SPARK (GitHub Issues are disabled). See the contributing guide.
License
Apache License 2.0.
Metadata
Release files for pyspark-client-rust 4.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyspark_client_rust-4.2.0.tar.gz | 1.3 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pyspark_client_rust-4.2.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| pyspark_client_rust-4.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| pyspark_client_rust-4.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| pyspark_client_rust-4.2.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64, macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64) | Details |
Total release size: 36.2 MB
Release files / pyspark_client_rust-4.2.0.tar.gz
| Download URL | pyspark_client_rust-4.2.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64ad36fcb3c53fd0ee8c7ffec3bc7fd1bb620295dc841ff733cc62a73b993cfe
|
|
BLAKE2b-256 checksum How to use checksums |
68ee2b55d25fde1e14220725d335fdf142a623e69db844af3de0939cdb928447
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / pyspark_client_rust-4.2.0-cp39-abi3-win_amd64.whl
| Download URL | pyspark_client_rust-4.2.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 7.3 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7c73b6eb48fd6bf63e41640a050161ef2527a825dfa4aa5ec5bbd2bcb9510fac
|
|
BLAKE2b-256 checksum How to use checksums |
a1d090590b79cef17641f44e22f37e354d7f623de305b15406a40868f8f3904f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / pyspark_client_rust-4.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyspark_client_rust-4.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 7.2 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
540ada4474069ce9409839990a41ea4505a3ab3e8d0ceb1730986abb4f71dbdb
|
|
BLAKE2b-256 checksum How to use checksums |
9d3b3d75ce89552a860da3a9af165e1acda2df249f89aade404f175ca36699d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / pyspark_client_rust-4.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyspark_client_rust-4.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 6.8 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
491be13521774a21cb508fee5c7f45e57468bc78ccceb896f67badafc054ffd7
|
|
BLAKE2b-256 checksum How to use checksums |
2acb351ad889eb59aa0b86aec7598d6d7609aa28c3171dcce5cb4fc524f0418b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / pyspark_client_rust-4.2.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | pyspark_client_rust-4.2.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 13.6 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f3db85fcdfb24fed66691d7493b2f05a458360a7d03654528528340873a5cf32
|
|
BLAKE2b-256 checksum How to use checksums |
561f8d74300a26a4e903371394a9bf89b5d185bdec4492bb78a2af4273443fe1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|