SparkConnect

0.5.0

Apache Spark Connect Client for Swift
apache/spark-connect-swift

What's New

0.5.0

2026-01-15T12:59:30Z

Apache Sparkā„¢ Connect Client for Swift language is a subproject of Apache Spark and aims to provide Swift implementation of Spark Connect. 0.5.0 is the fifth release of Apache Spark Connect for Swift client. This is still experimental.

Website

https://apache.github.io/spark-connect-swift/

Swift Package Index

https://swiftpackageindex.com/apache/spark-connect-swift

Documentation

https://swiftpackageindex.com/apache/spark-connect-swift/0.5.0/documentation/sparkconnect

Full Changelog

0.4.0...0.5.0

Resolved Issues

  • [SPARK-53750] Use 4.1.0-preview2 instead of RC1
  • [SPARK-53763] Update integration-test-ubuntu-spark41 to use Spark 4.1.0-preview2
  • [SPARK-53765] Remove Daily integration-test-linux GitHub Action job
  • [SPARK-53774] Update Spark Connect-generated Swift code with protocgen-grpc-swift-2 v2.1.1
  • [SPARK-53777] Update Spark Connect-generated Swift source code with 4.1.0-preview2
  • [SPARK-54042] Use 4.1.0-preview3 in integration-test-(token|mac-spark41)
  • [SPARK-54043] Update Spark Connect-generated Swift source code with 4.1.0-preview3 RC1
  • [SPARK-54044] Upgrade gRPC Swift NIO Transport to 2.2.0
  • [SPARK-54045] Upgrade FlatBuffers to v25.9.23
  • [SPARK-54053] Use Swift 6.2 for all Linux CIs
  • [SPARK-54077] Enable all disabled tests on Linux
  • [SPARK-54080] Use Swift 6.2 as the minimum supported version
  • [SPARK-54083] Use 4.1.0-preview3 instead of RC1
  • [SPARK-54105] Update integration-test-ubuntu-spark41 to use Spark 4.1.0-preview3-java21
  • [SPARK-54398] Use 4.1.0-preview4 in integration-test-(token|mac-spark41)
  • [SPARK-54401] Upgrade grpc-swift-2 to 2.2.0
  • [SPARK-54402] Upgrade gRPC Swift NIO Transport to 2.3.0
  • [SPARK-54430] Use 4.1.0-preview4 instead of RC1
  • [SPARK-54431] Update integration-test-ubuntu-spark41 to use Spark 4.1.0-preview4-java21
  • [SPARK-54681] Upgrade actions/checkout to v6
  • [SPARK-54756] Use 4.1.0 instead of preview in GitHub Action CIs
  • [SPARK-54773] Make README.md and Examples up-to-date with 4.1.0
  • [SPARK-54778] Upgrade grpc-swift-2 to 2.2.1
  • [SPARK-54779] Upgrade gRPC Swift NIO Transport to 2.4.0
  • [SPARK-54786] Upgrade gRPC Swift Protobuf to 2.1.2
  • [SPARK-54811] Use Spark 4.1.0 to regenerate Spark Connect-based Swift source code
  • [SPARK-54892] Support list data type
  • [SPARK-54893] Support listTables and getTable in Catalog
  • [SPARK-54897] Upgrade Iceberg to 1.10.1 in integration tests
  • [SPARK-54899] Upgrade FlatBuffers to v25.12.19
  • [SPARK-54935] Improve Row.== to support array types
  • [SPARK-54981] Improve DataFrame.collect to support Bool|Int|Float|Double types via [any Sendable] cast
  • [SPARK-54998] Disable ConstraintTests
  • [SPARK-55006] Use Spark 4.1.1 for Spark 4.1 integration tests
  • [SPARK-55007] Make README.md and Examples up-to-date with 4.1.1

Apache Spark Connect Client for Swift

GitHub Actions Build Swift Version Compatibility Platform Compatibility

This is an experimental Swift library to show how to connect to a remote Apache Spark Connect Server and run SQL statements to manipulate remote data.

So far, this library project is tracking the upstream changes of Apache Arrow project's Swift-support.

Resources

Requirement

How to use in your apps

Create a Swift project.

mkdir SparkConnectSwiftApp
cd SparkConnectSwiftApp
swift package init --name SparkConnectSwiftApp --type executable

Add SparkConnect package to the dependency like the following

$ cat Package.swift
import PackageDescription

let package = Package(
  name: "SparkConnectSwiftApp",
  platforms: [
    .macOS(.v15)
  ],
  dependencies: [
    .package(url: "https://github.com/apache/spark-connect-swift.git", branch: "main")
  ],
  targets: [
    .executableTarget(
      name: "SparkConnectSwiftApp",
      dependencies: [.product(name: "SparkConnect", package: "spark-connect-swift")]
    )
  ]
)

Use SparkSession of SparkConnect module in Swift.

$ cat Sources/main.swift

import SparkConnect

let spark = try await SparkSession.builder.getOrCreate()
print("Connected to Apache Spark \(await spark.version) Server")

let statements = [
  "DROP TABLE IF EXISTS t",
  "CREATE TABLE IF NOT EXISTS t(a INT) USING ORC",
  "INSERT INTO t VALUES (1), (2), (3)",
]

for s in statements {
  print("EXECUTE: \(s)")
  _ = try await spark.sql(s).count()
}
print("SELECT * FROM t")
try await spark.sql("SELECT * FROM t").cache().show()

try await spark.range(10).filter("id % 2 == 0").write.mode("overwrite").orc("/tmp/orc")
try await spark.read.orc("/tmp/orc").show()

await spark.stop()

Run your Swift application.

$ swift run
...
Connected to Apache Spark 4.1.1 Server
EXECUTE: DROP TABLE IF EXISTS t
EXECUTE: CREATE TABLE IF NOT EXISTS t(a INT) USING ORC
EXECUTE: INSERT INTO t VALUES (1), (2), (3)
SELECT * FROM t
+---+
|  a|
+---+
|  1|
|  3|
|  2|
+---+

+---+
| id|
+---+
|  6|
|  8|
|  4|
|  2|
|  0|
+---+

You can find more complete examples including Spark SQL REPL, Web Server and Streaming applications in the Examples directory.

This library also supports SPARK_REMOTE environment variable to specify the Spark Connect connection string in order to provide more options.

Description

  • Swift Tools 6.2.0
View More Packages from this Author

Dependencies

Last updated: Tue Feb 03 2026 03:39:43 GMT-1000 (Hawaii-Aleutian Standard Time)