Jump to content

Spark Connect client

From Open Lakehouse Wiki
Spark Connect client
Also known as Thin client, Spark Connect client library
Field Distributed data processing, client-server protocols
Introduced Apache Spark 3.4.0 (Python client)
Key parts Protocol Buffers plan builder, gRPC channel, Apache Arrow result decoder, sc:// connection string
Open source implementations PySpark (pyspark-client), Scala (spark-connect-client-jvm), JDBC driver, Go, Swift, Rust
Related Spark Connect, Spark Connect server, Spark Connect plugin, Apache Spark
Last verified 23 November 2026 against the Spark 4.3.0 Spark Connect overview and sql/connect/docs/client-connection-string.md at tag v4.3.0; the GitHub repositories, READMEs, tags and releases of apache/spark-connect-go, apache/spark-connect-swift, apache/spark-connect-rust, GoEddie/spark-connect-dotnet and yaooqinn/spark.js; PyPI, crates.io, Maven Central and the Apache Spark download directory.

A Spark Connect client is a library that lets an application use Apache Spark remotely through the Spark Connect protocol: it builds unresolved logical plans as Protocol Buffers messages, sends them to a Spark Connect server over gRPC, and decodes the results, which come back as Apache Arrow record batches.[1] A Spark Connect client runs in its own process, separate from the Spark driver, and does not reach into the driver JVM; the PySpark client does not use Py4J.[1] The pyspark-client package leaves Py4J out and depends only on Python libraries such as pyarrow and grpcio, so it needs no local Spark JVM.[2] Because the protocol is language-agnostic, a client can be written in any language with gRPC and Arrow support, and the Scala client (spark-connect-client-jvm) and the JDBC driver are themselves JVM libraries.[1][3] The Apache Spark project ships Python and Scala clients and a JDBC driver, and maintains separate Go, Swift and Rust clients; other clients are community projects.

What does a Spark Connect client do?

A Spark Connect client has three jobs. It turns DataFrame or SQL calls into a protobuf plan, manages a gRPC channel and session with the server, and turns Arrow batches into native values. The Spark documentation describes the protocol as language-agnostic, and the server runs every plan through the normal Spark optimizer and execution engine, so a query from a Go client and the same query from PySpark run the same way on the server.[1]

All official clients address the server with the same connection string format, sc://host:port/;param=value. The Spark Connect developer guidelines ask new clients to follow this format so that the user experience is the same in every language. The parameters include token, use_ssl, user_id, user_agent, session_id and gRPC keepalive settings, and the default port is 15002.[4][5]

Which Spark Connect clients exist?

The following table lists the clients maintained under the Apache Spark project, followed by two community clients. "Latest release" is the newest version found on 23 November 2026, and "stated status" quotes or paraphrases each project's own description.

Client Repository and package Language Latest release Stated status Notable gaps
PySpark client apache/spark; PyPI pyspark-client Python 4.3.0 (30 October 2026)[6] Part of each Spark release; supports most PySpark APIs since Spark 3.4[1] No SparkContext or RDD API[1]
Scala client apache/spark; Maven spark-connect-client-jvm_2.13 Scala 4.3.0[7] Part of each Spark release; supports most Scala APIs since Spark 3.5[1] No SparkContext or RDD API; UDF classes and JARs must be uploaded as artifacts[1]
JDBC driver apache/spark; Maven spark-connect-client-jdbc_2.13 Java (JDBC) 4.3.0[3] Added in Spark 4.1.0 (SPARK-53484); Spark 4.3.0 describes it as "more complete"[8][9] SQL only; ARRAY, MAP and STRUCT support arrived in 4.3.0 (SPARK-57380)[9]
Go client apache/spark-connect-go Go v0.1.0 (GitHub release, 17 June 2025)[10] "Highly experimental and should not be used in any production setting"; the Spark PMC reserves the right to withdraw it[11] The spark/sql package has session, DataFrame, reader, writer, grouping, NA and statistics APIs, but no streaming or UDF API; last commit on master in August 2025[12][13]
Swift client apache/spark-connect-swift Swift 0.8.0 (13 November 2026)[14] "Still experimental" (0.8.0 release notes); source releases published in the Apache Spark download directory[14][15] UDFs only by registering existing Java UDF classes on the server, not in Swift; README lists Spark 4.3.0 as the requirement[16][17]
Rust client apache/spark-connect-rust; crate apache-spark-connect, PyPI pyspark-client-rust Rust, with a Python wrapper 4.3.0 (git tag and packages, 16 November 2026)[18][19] README claims full public-API parity with PySpark 4.3.0 for the Python wrapper; targets Spark 4.3.0 and later[20][21] Native Rust API excludes APIs that need Python itself, such as pandas; UDFs are Rust functions compiled to WebAssembly[22]
.NET client (community) GoEddie/spark-connect-dotnet C# and other .NET languages v4.0.0-build.41 (3 October 2026)[23] Not an Apache project (MIT license)[23] README says keeping up with new Spark versions is hard and advises users to be prepared to make their own gRPC calls for functions the library lacks[23]
JavaScript client (community) yaooqinn/spark.js; npm @yaooqinn/spark.js TypeScript v0.1.0 (git tag, January 2026)[24] "Experimental"; APIs may change without notice[24] Requires Spark 4.0 or later[24]

The Apache Spark download directory lists source releases of the Swift client but none of the Go or Rust clients.[15] The Rust client replaced an earlier community project, sjrusso8/spark-connect-rs, whose repository is now read-only and points to apache/spark-connect-rust.[25] The Rust repository also contains an unpublished, experimental Rust server frontend intended for local, trusted experiments.[20]

How is a client connected to a server?

In PySpark, the pyspark-client package contains only the Spark Connect client, and SparkSession.builder.remote() takes the connection string.[1] The following example connects over TLS with a bearer token; according to the connection string reference, setting token also enables TLS.[4]

# pip install pyspark-client==4.3.0
from pyspark.sql import SparkSession

spark = (
    SparkSession.builder
    .remote("sc://spark.example.com:443/;use_ssl=true;token=MY_TOKEN;user_agent=etl_app")
    .getOrCreate()
)
print(spark.version)
spark.sql("SELECT 1 AS ok").show()

The same string can be set in the SPARK_REMOTE environment variable. The Swift README states that its client also reads SPARK_REMOTE, and the Rust and JavaScript clients take an sc:// address in their builders.[1][17][20][24]

Spark Connect client vs classic Spark application

A Spark Connect client differs from a classic PySpark or Scala application because it runs outside the driver:[1]

Spark Connect client Classic Spark application
Process Separate from the driver; talks to it over gRPC Runs inside the driver process (Py4J bridge for PySpark)
SparkContext and RDDs Not available Available
Cluster-wide and static configuration Not accessible; session settings only Accessible
Dependencies Client library only; server upgraded independently Shares the driver's process and dependencies

See also

References

  1. ↑ 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 Spark Connect Overview (Spark 4.3.0). Apache Software Foundation.Retrieved 2026-11-23.
  2. ↑ python/packaging/client/setup.py (tag v4.3.0). Apache Spark on GitHub.Retrieved 2026-11-23.
  3. ↑ 3.0 3.1 spark-connect-client-jdbc_2.13 maven-metadata.xml. Maven Central.Retrieved 2026-11-23.
  4. ↑ 4.0 4.1 Connecting to Spark Connect using Clients (sql/connect/docs/client-connection-string.md, tag v4.3.0). Apache Spark on GitHub.Retrieved 2026-11-23.
  5. ↑ sql/connect/README.md (tag v4.3.0). Apache Spark on GitHub.Retrieved 2026-11-23.
  6. ↑ pyspark-client. Python Package Index.Retrieved 2026-11-23.
  7. ↑ spark-connect-client-jvm_2.13 maven-metadata.xml. Maven Central.Retrieved 2026-11-23.
  8. ↑ Spark Release 4.1.0. Apache Software Foundation.Retrieved 2026-11-23.
  9. ↑ 9.0 9.1 Spark Release 4.3.0. Apache Software Foundation.Retrieved 2026-11-23.
  10. ↑ Releases: apache/spark-connect-go. GitHub.Retrieved 2026-11-23.
  11. ↑ apache/spark-connect-go README. GitHub.Retrieved 2026-11-23.
  12. ↑ Commits: apache/spark-connect-go (master). GitHub.Retrieved 2026-11-23.
  13. ↑ apache/spark-connect-go: spark/sql. GitHub.Retrieved 2026-11-23.
  14. ↑ 14.0 14.1 Release 0.8.0: apache/spark-connect-swift. GitHub.Retrieved 2026-11-23.
  15. ↑ 15.0 15.1 Index of /spark. Apache Software Foundation.Retrieved 2026-11-23.
  16. ↑ UDFRegistration.swift (tag 0.8.0). GitHub.Retrieved 2026-11-23.
  17. ↑ 17.0 17.1 apache/spark-connect-swift README. GitHub.Retrieved 2026-11-23.
  18. ↑ apache-spark-connect. crates.io.Retrieved 2026-11-23.
  19. ↑ pyspark-client-rust. Python Package Index.Retrieved 2026-11-23.
  20. ↑ 20.0 20.1 20.2 apache/spark-connect-rust README. GitHub.Retrieved 2026-11-23.
  21. ↑ Compatibility (Spark Connect Rust Client documentation). Apache Software Foundation.Retrieved 2026-11-23.
  22. ↑ Spark Connect Rust Client documentation. Apache Software Foundation.Retrieved 2026-11-23.
  23. ↑ 23.0 23.1 23.2 GoEddie/spark-connect-dotnet. GitHub.Retrieved 2026-11-23.
  24. ↑ 24.0 24.1 24.2 24.3 yaooqinn/spark.js. GitHub.Retrieved 2026-11-23.
  25. ↑ sjrusso8/spark-connect-rs. GitHub.Retrieved 2026-11-23.