abandy commented on code in PR #37764:
URL: https://github.com/apache/arrow/pull/37764#discussion_r1372406514
##########
swift/ArrowFlight/Sources/ArrowFlight/FlightClient.swift:
##########
@@ -28,6 +28,40 @@ public class FlightClient {
client = Arrow_Flight_Protocol_FlightServiceAsyncClient(channel:
channel)
}
+ private func readMessages(_ responseStream:
GRPCAsyncResponseStream<Arrow_Flight_Protocol_FlightData>) async throws ->
ArrowReader.ArrowReaderResult {
+ let reader = ArrowReader()
+ let arrowResult = ArrowReader.MakeArrowReaderResult();
+ for try await data in responseStream {
+ switch reader.fromMessage(data.dataHeader, dataBody:
data.dataBody, result: arrowResult) {
+ case .success(_):
+ continue;
+ case .failure(let error):
+ throw error
+ }
+ }
+
+ return arrowResult;
+ }
+
+ private func writeBatches(_ requestStream:
GRPCAsyncRequestStreamWriter<Arrow_Flight_Protocol_FlightData>, descriptor:
FlightDescriptor, recordBatchs: [RecordBatch]) async throws {
+ let writer = ArrowWriter()
+ switch writer.toMessage(recordBatchs[0].schema) {
+ case .success(let schemaData):
+ try await requestStream.send(FlightData(schemaData, dataBody:
Data(), flightDescriptor: descriptor).toProtocol())
+ for rc in recordBatchs {
+ switch writer.toMessage(rc) {
Review Comment:
Good catch, will update, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]