Skip to content
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

Experimental Swift SDK Implementation #28062

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
42537b8
Moving experimental Swift SDK code into Beam repo structure. Cleaning…
Aug 10, 2023
8fb6fa6
Merge branch 'apache:master' into swift-sdk
byronellis Aug 10, 2023
7cae975
Adding more of the Swift SDK implementation
Aug 10, 2023
78a5c26
Refactor Unary and Tuple SerializableFn into a single ClosureFn since…
Aug 14, 2023
288bb9e
Merge remote-tracking branch 'origin/swift-sdk' into swift-sdk
Aug 14, 2023
9d72851
Merge branch 'apache:master' into swift-sdk
byronellis Aug 14, 2023
fc6853c
Moving some stuff around to make the proto construction code easier t…
Aug 15, 2023
2322d6d
Add missing file
Aug 15, 2023
79b783f
Merge remote-tracking branch 'origin/swift-sdk' into swift-sdk
Aug 15, 2023
2cc34a2
Merge branch 'apache:master' into swift-sdk
byronellis Aug 15, 2023
fe5e52c
Add the rest of the code. Basic word count integration test now compl…
Aug 17, 2023
4c151d6
Merge remote-tracking branch 'origin/swift-sdk' into swift-sdk
Aug 17, 2023
fbbdf92
Add licenses everywhere
Aug 17, 2023
00bddd5
Add the generated proto files so other people don't have to do it alo…
Aug 17, 2023
c5c5247
Use a single advance in varint implementation
Aug 17, 2023
4f7b34b
Small change to try to stop crashing on Linux
Aug 17, 2023
334137f
Trying to stop advanced(by:) crashes on non-macOS platforms
Aug 17, 2023
f80e850
safeAdvance to try to address issues with zero-length data elements o…
Aug 17, 2023
03ab276
Move typealiases for model protos to make it easier to find and less …
Aug 17, 2023
56f0bc1
Turns out String interpolation breaks the #file and #line macros. Try…
Aug 17, 2023
7cfc6a7
Second attempt and fixing the line values.
Aug 17, 2023
6355d3d
Remove random output file
Aug 18, 2023
88b39fc
Start stubbing out more of the composite transform implementation. St…
Aug 21, 2023
da105ab
Added backwards links in PCollections to support Composite transforms…
Aug 22, 2023
b2f6ae0
Added the primitives for a FileIO implementation with Google Storage …
Aug 24, 2023
26d4b64
Rename previous stream-based pardo implementation to pstream and star…
Aug 25, 2023
5af51c1
Changes to allow Swift SDK to operate successfully with the Flink Por…
Aug 25, 2023
5b3f918
Added support for bounded and unbounded PCollections. Fixes to bundle…
Aug 28, 2023
e469523
Update .gitignore
lostluck Aug 29, 2023
f6da199
Support for Schema and Row. Fixed up a couple of areas are endianess …
Sep 1, 2023
adc5c4c
More work on Schema support to allow for external transforms
Sep 5, 2023
0b3b8df
Merge remote-tracking branch 'origin/swift-sdk' into swift-sdk
Sep 5, 2023
e499f0e
WIP Schemas
Sep 15, 2023
c5c8c3d
Integrate and apply swiftformat to code and put license headers every…
Sep 15, 2023
580bf0b
Some more WIP on composite transforms
Sep 20, 2023
c95f717
More WIP on Composite Transforms
Sep 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ sdks/python/postcommit_requirements.txt
sdks/python/.coverage
sdks/python/coverage.xml

# Ignore files generated by the Swift build process.
sdks/swift/.build/**/*

# Ignore IntelliJ files.
**/.idea/**/*
**/*.iml
Expand Down
2 changes: 2 additions & 0 deletions sdks/swift/.swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--exclude Sources/ApacheBeam/Generated
--header "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * "License"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"
203 changes: 203 additions & 0 deletions sdks/swift/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
{
"pins" : [
{
"identity" : "aws-crt-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-crt-swift",
"state" : {
"revision" : "997904873945e074aaf5c51ea968d9a84684525a",
"version" : "0.13.0"
}
},
{
"identity" : "aws-sdk-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-sdk-swift.git",
"state" : {
"revision" : "3f0372fb67f1460d15bf1f8c2cc794cce582712f",
"version" : "0.25.0"
}
},
{
"identity" : "bigint",
"kind" : "remoteSourceControl",
"location" : "https://github.com/attaswift/BigInt",
"state" : {
"revision" : "0ed110f7555c34ff468e72e1686e59721f2b0da6",
"version" : "5.3.0"
}
},
{
"identity" : "cryptoswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
"state" : {
"revision" : "af1b58fc569bfde777462349b9f7314b61762be0",
"version" : "1.3.2"
}
},
{
"identity" : "google-auth-library-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/googleapis/google-auth-library-swift",
"state" : {
"revision" : "4b510d91fc74f1415eae6dabc9836b8c3e1f44f6",
"version" : "0.5.3"
}
},
{
"identity" : "grpc-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/grpc/grpc-swift.git",
"state" : {
"revision" : "735d88f8196467f24189896f29c4625af7cbd072",
"version" : "1.19.0"
}
},
{
"identity" : "smithy-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/smithy-lang/smithy-swift",
"state" : {
"revision" : "94b319e7f7f48c43eb5d69e2d929f39d1a39fb32",
"version" : "0.29.0"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
"version" : "1.2.3"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "6c89474e62719ddcc1e9614989fff2f68208fe10",
"version" : "1.1.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version" : "1.0.4"
}
},
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-plugin",
"state" : {
"revision" : "26ac5758409154cc448d7ab82389c520fa8a8247",
"version" : "1.3.0"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "32e8d724467f8fe623624570367e3d50c5638e46",
"version" : "1.5.2"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "cf281631ff10ec6111f2761052aa81896a83a007",
"version" : "2.58.0"
}
},
{
"identity" : "swift-nio-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-extras.git",
"state" : {
"revision" : "0e0d0aab665ff1a0659ce75ac003081f2b1c8997",
"version" : "1.19.0"
}
},
{
"identity" : "swift-nio-http2",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-http2.git",
"state" : {
"revision" : "a8ccf13fa62775277a5d56844878c828bbb3be1a",
"version" : "1.27.0"
}
},
{
"identity" : "swift-nio-ssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl.git",
"state" : {
"revision" : "e866a626e105042a6a72a870c88b4c531ba05f83",
"version" : "2.24.0"
}
},
{
"identity" : "swift-nio-transport-services",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-transport-services.git",
"state" : {
"revision" : "5fd1458c245d5741b3c8ebe55489f590c6ca8f15",
"version" : "1.18.0"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "ce20dc083ee485524b802669890291c0d8090170",
"version" : "1.22.1"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"branch" : "main",
"revision" : "e99a57389920382f1a8a9b63bda04f4eadc69d49"
}
},
{
"identity" : "swiftformat",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nicklockwood/SwiftFormat",
"state" : {
"revision" : "1c1bf3b72a020cabe39ce7cd31fc47a3fdc90b44",
"version" : "0.52.3"
}
},
{
"identity" : "xmlcoder",
"kind" : "remoteSourceControl",
"location" : "https://github.com/MaxDesiatov/XMLCoder.git",
"state" : {
"revision" : "80b4a1646399b8e4e0ce80711653476a85bd5e37",
"version" : "0.17.0"
}
}
],
"version" : 2
}
93 changes: 93 additions & 0 deletions sdks/swift/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// swift-tools-version: 5.9
// 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 CompilerPluginSupport
import PackageDescription

let dependencies: [Package.Dependency] = [
// Core Dependencies
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.19.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.0"),
// .package(url: "https://github.com/apple/swift-metrics.git", from: "2.0.0"),

// Additional Transform Dependencies
.package(url: "https://github.com/awslabs/aws-sdk-swift.git", from: "0.23.0"),
.package(url: "https://github.com/googleapis/google-auth-library-swift",from:"0.0.0"),
// .package(url: "https://github.com/pvieito/PythonKit.git", branch: "master"),

// Swift Macro Support
.package(url: "https://github.com/apple/swift-syntax.git", branch: "main"),

// Swift Package Manager Plugins
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.52.3"),
]

let package = Package(
name: "ApacheBeam",
platforms: [
.macOS("13.0")
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "ApacheBeam",
targets: ["ApacheBeam"]),
.executable(
name: "Wordcount",
targets: ["Wordcount"])
],
dependencies: dependencies,
targets: [
.macro(
name: "ApacheBeamPlugin",
dependencies: [
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftOperators", package: "swift-syntax"),
.product(name: "SwiftParser", package: "swift-syntax"),
.product(name: "SwiftParserDiagnostics", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
]
),
.target(
name: "ApacheBeam",
dependencies: [
// "ApacheBeamPlugin", // This is disabled until it is supported on Linux
.product(name: "GRPC",package:"grpc-swift"),
.product(name: "Logging",package:"swift-log"),
.product(name: "AWSS3",package:"aws-sdk-swift"),
.product(name: "OAuth2", package:"google-auth-library-swift"),
.product(name: "ArgumentParser", package:"swift-argument-parser")
]
),
.executableTarget(
name:"Wordcount",
dependencies: ["ApacheBeam",
.product(name: "ArgumentParser", package:"swift-argument-parser")],
path:"Sources/Examples/Wordcount"),
.testTarget(
name: "ApacheBeamTests",
dependencies: ["ApacheBeam"],
exclude:["Pipeline/Fixtures/file1.txt","Pipeline/Fixtures/file2.txt"]
),
]
)
25 changes: 25 additions & 0 deletions sdks/swift/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Swift SDK for Beam

The Swift SDK for Beam is a "portable" Beam implementation written in native Swift.

## Usage

To use the Swift SDK for Beam you should add it to your own executable package as a dependency:
```
let package = Package(
dependencies:[
.package(url:"https://github.com/apache/beam/sdks/swift, from: "2.51.0")
],
targets:[
// targets
]
)
```

## Writing a Pipeline

```
import ApacheBeam



Loading
Loading