-
Notifications
You must be signed in to change notification settings - Fork 5
[SPARK-51461] Setup SparkConnect
Swift package structure and CI to test build
#4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,6 @@ header: | |
- 'NOTICE' | ||
- '.asf.yaml' | ||
- '.nojekyll' | ||
- 'Package.swift' | ||
|
||
comment: on-failure |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Xcode | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following is a standard Git ignore pattern for |
||
# | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
|
||
## Swift Package Manager | ||
Package.resolved | ||
.swiftpm/ | ||
|
||
## User settings | ||
xcuserdata/ | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
|
||
## App packaging | ||
*.ipa | ||
*.dSYM.zip | ||
*.dSYM | ||
|
||
## Playgrounds | ||
timeline.xctimeline | ||
playground.xcworkspace | ||
|
||
# Swift Package Manager | ||
# | ||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. | ||
# Packages/ | ||
# Package.pins | ||
# Package.resolved | ||
# *.xcodeproj | ||
# | ||
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata | ||
# hence it is not needed unless you have added a package configuration file to your project | ||
# .swiftpm | ||
|
||
.build/ | ||
|
||
# CocoaPods | ||
# | ||
# We recommend against adding the Pods directory to your .gitignore. However | ||
# you should judge for yourself, the pros and cons are mentioned at: | ||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | ||
# | ||
# Pods/ | ||
# | ||
# Add this line if you want to avoid checking in source code from the Xcode workspace | ||
# *.xcworkspace | ||
|
||
# Carthage | ||
# | ||
# Add this line if you want to avoid checking in source code from Carthage dependencies. | ||
# Carthage/Checkouts | ||
|
||
Carthage/Build/ | ||
|
||
# fastlane | ||
# | ||
# It is recommended to not store the screenshots in the git repo. | ||
# Instead, use fastlane to re-generate the screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://docs.fastlane.tools/best-practices/source-control/#source-control | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots/**/*.png | ||
fastlane/test_output |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,68 +199,3 @@ | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's also create a NOTICE file, here is an example https://www.apache.org/licenses/example-NOTICE.txt If we have required third-party notices or licenses, we shall also record those portions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, Thank you, @yaooqinn . |
||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rest of this file is copied from Apache Spark repository and is invalid in this Swift repository. |
||
|
||
------------------------------------------------------------------------------------ | ||
This product bundles various third-party components under other open source licenses. | ||
This section summarizes those components and their licenses. See licenses/ | ||
for text of these licenses. | ||
|
||
|
||
Apache Software Foundation License 2.0 | ||
-------------------------------------- | ||
|
||
common/network-common/src/main/java/org/apache/spark/network/util/LimitedInputStream.java | ||
core/src/main/java/org/apache/spark/util/collection/TimSort.java | ||
core/src/main/resources/org/apache/spark/ui/static/bootstrap* | ||
core/src/main/resources/org/apache/spark/ui/static/vis* | ||
connector/spark-ganglia-lgpl/src/main/java/com/codahale/metrics/ganglia/GangliaReporter.java | ||
core/src/main/resources/org/apache/spark/ui/static/d3-flamegraph.min.js | ||
core/src/main/resources/org/apache/spark/ui/static/d3-flamegraph.css | ||
|
||
Python Software Foundation License | ||
---------------------------------- | ||
|
||
python/pyspark/loose_version.py | ||
|
||
BSD 3-Clause | ||
------------ | ||
|
||
python/lib/py4j-*-src.zip | ||
python/pyspark/cloudpickle/*.py | ||
python/pyspark/join.py | ||
|
||
The CSS style for the navigation sidebar of the documentation was originally | ||
submitted by Óscar Nájera for the scikit-learn project. The scikit-learn project | ||
is distributed under the 3-Clause BSD license. | ||
|
||
|
||
MIT License | ||
----------- | ||
|
||
core/src/main/resources/org/apache/spark/ui/static/dagre-d3.min.js | ||
core/src/main/resources/org/apache/spark/ui/static/*dataTables* | ||
core/src/main/resources/org/apache/spark/ui/static/graphlib-dot.min.js | ||
core/src/main/resources/org/apache/spark/ui/static/jquery* | ||
core/src/main/resources/org/apache/spark/ui/static/sorttable.js | ||
docs/js/vendor/bootstrap* | ||
docs/js/vendor/anchor.min.js | ||
docs/js/vendor/jquery* | ||
docs/js/vendor/modernizer* | ||
docs/js/vendor/docsearch.min.js | ||
|
||
ISC License | ||
----------- | ||
|
||
core/src/main/resources/org/apache/spark/ui/static/d3.min.js | ||
|
||
|
||
Creative Commons CC0 1.0 Universal Public Domain Dedication | ||
----------------------------------------------------------- | ||
(see LICENSE-CC0.txt) | ||
|
||
data/mllib/images/kittens/29.5.a_b_EGDP022204.jpg | ||
data/mllib/images/kittens/54893.jpg | ||
data/mllib/images/kittens/DP153539.jpg | ||
data/mllib/images/kittens/DP802813.jpg | ||
data/mllib/images/multi-channel/chr30.4.184.jpg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// swift-tools-version: 6.0 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
// | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "SparkConnect", | ||
platforms: [ | ||
.macOS(.v15), | ||
.iOS(.v18), | ||
.watchOS(.v11), | ||
.tvOS(.v18), | ||
], | ||
products: [ | ||
.library( | ||
name: "SparkConnect", | ||
targets: ["SparkConnect"]) | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/grpc/grpc-swift.git", from: "2.1.0"), | ||
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.1.0"), | ||
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.1"), | ||
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.9.0"), | ||
.package(url: "https://github.com/google/flatbuffers.git", branch: "v24.3.7"), | ||
], | ||
targets: [ | ||
.target( | ||
name: "SparkConnect", | ||
dependencies: [ | ||
.product(name: "GRPCCore", package: "grpc-swift"), | ||
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"), | ||
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"), | ||
.product(name: "SwiftyTextTable", package: "SwiftyTextTable"), | ||
.product(name: "FlatBuffers", package: "flatbuffers"), | ||
] | ||
), | ||
.testTarget( | ||
name: "SparkConnectTests", | ||
dependencies: ["SparkConnect"] | ||
), | ||
] | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,60 @@ | ||
# Apache Spark Connect Client for Swift language | ||
# Apache Spark Connect Client for Swift | ||
|
||
[](https://github.com/apache/spark-connect-swift/blob/main/.github/workflows/build_and_test.yml) | ||
|
||
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. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that the project is still in an experimental phase, it would be good to add a DISCLAIMER file
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, do we have it in our sister repository, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm afraid not, Apache Spark PMC doesn't quite follow the ASF podling incubation process for subprojects There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Especially, the IP clearance part for huge donations :) |
||
So far, this library project is tracking the upstream changes like the [Apache Spark](https://spark.apache.org) 4.0.0 RC2 release and [Apache Arrow](https://arrow.apache.org) project's Swift-support. | ||
|
||
## Requirement | ||
- [Apache Spark 4.0.0 RC2 (March 2025)](https://dist.apache.org/repos/dist/dev/spark/v4.0.0-rc2-bin/) | ||
- [Swift 6.0 (2024)](https://swift.org) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, let me remove this section. |
||
- [gRPC Swift 2.1 (March 2025)](https://github.com/grpc/grpc-swift/releases/tag/2.1.0) | ||
- [gRPC Swift Protobuf 1.0 (March 2025)](https://github.com/grpc/grpc-swift-protobuf/releases/tag/1.1.0) | ||
- [gRPC Swift NIO Transport 1.0 (March 2025)](https://github.com/grpc/grpc-swift-nio-transport/releases/tag/1.0.1) | ||
- [Apache Arrow Swift](https://github.com/apache/arrow/tree/main/swift) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see Arrow in the dependencies, is it a transitive dependency? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now, Apache Arrow didn't make a So, I borrowed and edited some files from Apache Arrow like Apache Spark did for Apache Hive Thrift Server module. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will be replaced with the official Apache Arrow Swift artifacts when they start to release~ |
||
## Run `Apache Spark 4.0.0 RC2 Connect Server` | ||
|
||
$ curl -LO https://dist.apache.org/repos/dist/dev/spark/v4.0.0-rc2-bin/spark-4.0.0-bin-hadoop3.tgz | ||
$ tar xvfz spark-4.0.0-bin-hadoop3.tgz | ||
$ cd spark-4.0.0-bin-hadoop3 | ||
$ sbin/start-connect-server.sh | ||
|
||
## Run tests | ||
|
||
``` | ||
$ cd spark-connect-swift | ||
$ swift test | ||
``` | ||
|
||
## 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")] | ||
) | ||
] | ||
) | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
|
||
/// A enum for ``SparkConnect`` package errors | ||
enum SparkConnectError: Error { | ||
case UnsupportedOperationException | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
|
||
import Testing | ||
|
||
@testable import SparkConnect | ||
|
||
/// A test suite for `SparkSession.Builder` | ||
@Suite(.serialized) | ||
struct BuilderTests { | ||
@Test | ||
func builderDefault() async throws { | ||
} | ||
|
||
@Test | ||
func remote() async throws { | ||
} | ||
|
||
@Test | ||
func appName() async throws { | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file has the required ASF license header. However, the first line of this file should be
swift-tools-version: 6.0
. So, I added here inevitably.