Skip to content

feat!: Migrate ArrowFlight to grpc-swift-2 (GRPCCore) and swift-protobuf 1.39 - #202

Open
sidpug-arcana wants to merge 5 commits into
apache:mainfrom
sidpug-arcana:feat/grpc-swift-2
Open

sidpug-arcana wants to merge 5 commits into
apache:mainfrom
sidpug-arcana:feat/grpc-swift-2

Conversation

@sidpug-arcana

@sidpug-arcana sidpug-arcana commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What's Changed

Migrates ArrowFlight from grpc-swift 1.x to the new grpc-swift 2.x stack (GRPCCore + NIO HTTP/2 transport + protobuf codecs), and bumps swift-protobuf to 1.39.0.

Stacked on #201 (flatbuffers 25.12.19 regeneration) — this branch contains those commits as well; only the last two commits are specific to this change. Once #201 lands, this PR can be rebased to just the grpc-swift-2 migration.

Details

  • Dependencies: replace grpc-swift 1.x with grpc-swift-2 (2.4.4), grpc-swift-nio-transport (GRPCNIOTransportHTTP2) and grpc-swift-protobuf (GRPCProtobuf); swift-protobuf bumped to 1.39.0.
  • Generated code: Flight.pb.swift regenerated with protoc-gen-swift 1.39 (now includes PollFlightInfo/PollInfo) and Flight.grpc.swift regenerated with protoc-gen-grpc-swift-2, from the same Flight.proto revision as before. FlightSql.pb.swift is regenerated with the same plugin for the same revision; the previously committed copy was generated by an older plugin and its _NameMap uses are deprecated in swift-protobuf 1.39, which is an error under -warnings-as-errors. New gen-flight.sh documents the regeneration.
  • ArrowFlight API:
    • FlightClient is now generic over the client transport (FlightClient<Transport>), constructible from a transport or an existing GRPCClient; streaming callbacks are @Sendable @escaping. State that the callbacks update (e.g. the doPut "callback called" flag) uses ManagedAtomic so it can be mutated from a @Sendable closure.
    • InternalFlightServer implements the generated SimpleServiceProtocol; PollFlightInfo is stubbed as not-implemented.
    • makeFlightServer returns any RegistrableRPCService for use with GRPCServer(transport:services:).
  • Platform requirements: GRPCCore requires macOS 15 / iOS 18 / watchOS 11 / tvOS 18 / visionOS 2, so ArrowFlight public APIs are now @available-gated accordingly. The Arrow core target is unaffected.
  • Toolchain: swift-tools-version bumped to 6.1 (all three grpc-swift-2 packages require it); the package remains in the Swift 5 language mode. CI matrices (test.yaml, rc.yaml) and the default CI Docker image updated to Swift 6.1 only — Swift 5.10/6.0 toolchains can no longer resolve the manifest.

Breaking changes

  • Requires Swift 6.1+ toolchain to build the package (runtime availability of Arrow core is unchanged).
  • ArrowFlight requires macOS 15/iOS 18+.
  • FlightClient construction and callback signatures changed (see above).

Testing

Full suite passes locally (macOS, Swift 6.4), including a build with the CI's -warnings-as-errors flags enabled:

Executed 51 tests, with 0 failures (0 unexpected)

The Flight integration test exercises a real GRPC server/client round trip over HTTP/2 (listActions, doPut, listFlights, doAction, getSchema, doGet, doExchange). The IPC file tests use fixtures generated by data-generator/swift-datagen, as in CI.

Closes #211.

@raulcd raulcd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is tagged as a MINOR issue, it doesn't feel like a MINOR to me.

@sidpug-arcana sidpug-arcana changed the title MINOR: [ArrowFlight] Migrate to grpc-swift-2 (GRPCCore) and swift-protobuf 1.39 [ArrowFlight] Migrate to grpc-swift-2 (GRPCCore) and swift-protobuf 1.39 Oct 29, 2026
@sidpug-arcana

Copy link
Copy Markdown
Contributor Author

My bad

@kou

kou commented Oct 29, 2026

Copy link
Copy Markdown
Member

Could you open a GitHub issue for this change and reference it from the PR description (Closes #NNN.)? See CONTRIBUTING.md:
https://github.com/apache/arrow-swift/blob/main/CONTRIBUTING.md#did-you-write-a-patch-that-fixes-a-bug-or-brings-an-improvement

Could you also update the PR title to follow Conventional Commits?

Bumps [github.com/google/flatbuffers](https://github.com/google/flatbuffers) from 25.2.10 to 25.12.19.
- [Release notes](https://github.com/google/flatbuffers/releases)
- [Commits](google/flatbuffers@v25.2.10...v25.12.19)

---
updated-dependencies:
- dependency-name: github.com/google/flatbuffers
  dependency-version: 25.12.19
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@sidpug-arcana sidpug-arcana changed the title [ArrowFlight] Migrate to grpc-swift-2 (GRPCCore) and swift-protobuf 1.39 feat!: Migrate ArrowFlight to grpc-swift-2 (GRPCCore) and swift-protobuf 1.39 Nov 2, 2026
sidpug-arcana and others added 4 commits November 2, 2026 15:50
Regenerate the Swift FlatBuffers sources with flatc 25.12.19 and
adapt the hand-written code to the new generated/runtime API:

- Vector accessors changed from `xxxCount`/`xxx(at:)` to typed
  Vector collections (`xxx.count`, `xxx[i]`)
- `FlatBufferObject` protocol split into `FlatBufferTable` /
  `FlatBufferStruct`
- `ByteBuffer(data:allowReadingUnalignedBuffers:)` was removed from
  the runtime; drop the now-obsolete `useUnalignedBuffers` plumbing
  from the IPC readers and ArrowFlight
- gen-flatbuffers.sh: add ARROW_FORMAT_DIR override and fix paths for
  the current repository layout

Co-authored-by: Siddharth Pugalia <sidpug@gmail.com>
Adapt the tests merged from main (TimeBitWidthTests, IPCTests) to
the new FlatbufferVector collection accessors.

Co-authored-by: Siddharth Pugalia <sidpug@gmail.com>
Swap grpc-swift 1.x for grpc-swift-2 (GRPCCore) and bump
swift-protobuf to the 1.35+ series.

Co-authored-by: Siddharth Pugalia <sidpug@gmail.com>
Replace grpc-swift 1.x with the grpc-swift 2.x stack:

- Add grpc-swift-nio-transport (GRPCNIOTransportHTTP2) and
  grpc-swift-protobuf (GRPCProtobuf) dependencies; grpc-swift-2
  provides GRPCCore.
- Regenerate Flight.pb.swift with protoc-gen-swift 1.39 (adds the
  PollFlightInfo/PollInfo definitions) and Flight.grpc.swift with
  protoc-gen-grpc-swift-2, both from the same Flight.proto revision
  as the previous generated code.
- Rewrite FlightServer/FlightClient and the record batch
  stream reader/writer on top of the GRPCCore API:
  - FlightClient is now generic over the client transport and
    accepts any GRPCClient/transport; response callbacks are
    @sendable @escaping.
  - InternalFlightServer implements the generated
    SimpleServiceProtocol and adds a PollFlightInfo stub.
  - makeFlightServer returns any RegistrableRPCService for use
    with GRPCServer(services:).
- ArrowFlight APIs are @available(macOS 15.0, iOS 18.0, watchOS 11.0,
  tvOS 18.0, visionOS 2.0, *) as required by GRPCCore.
- Bump swift-tools-version to 6.1 (required by the grpc-swift-2
  packages); the package stays in the Swift 5 language mode for now.
- Update CI matrices (test.yaml, rc.yaml) and the default Docker
  image to Swift 6.1; Swift 5.10/6.0 can no longer resolve the
  package manifest.
- Add gen-flight.sh to regenerate the Flight protobuf/gRPC sources.

Co-authored-by: Siddharth Pugalia <sidpug@gmail.com>
@sidpug-arcana

Copy link
Copy Markdown
Contributor Author

Thanks @kou — done on both counts.

  • Opened Migrate ArrowFlight to grpc-swift-2 (GRPCCore) and swift-protobuf 1.39 #211 to track the migration and added Closes #211. to the description.
  • The title is now feat!: Migrate ArrowFlight to grpc-swift-2 (GRPCCore) and swift-protobuf 1.39; the ! reflects the breaking changes listed in the description (Swift 6.1 toolchain, macOS 15/iOS 18 availability, FlightClient construction and callback signatures).

Note this PR is currently stacked on #201 for the flatbuffers 25.12.19 regeneration, which is why those commits appear here; I can rebase once #201 lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate ArrowFlight to grpc-swift-2 (GRPCCore) and swift-protobuf 1.39

3 participants