MCPcopy Create free account
hub / github.com/apache/arrow / RunExchangePut

Method RunExchangePut

cpp/src/arrow/flight/test_flight_server.cc:197–222  ·  view source on GitHub ↗

A simple example - act like DoPut

Source from the content-addressed store, hash-verified

195
196// A simple example - act like DoPut
197Status TestFlightServer::RunExchangePut(std::unique_ptr<FlightMessageReader> reader,
198 std::unique_ptr<FlightMessageWriter> writer) {
199 ARROW_ASSIGN_OR_RAISE(auto schema, reader->GetSchema());
200 if (!schema->Equals(ExampleIntSchema(), false)) {
201 return Status::Invalid("Schema is not as expected");
202 }
203 RecordBatchVector batches;
204 RETURN_NOT_OK(ExampleIntBatches(&batches));
205 FlightStreamChunk chunk;
206 for (const auto& batch : batches) {
207 ARROW_ASSIGN_OR_RAISE(chunk, reader->Next());
208 if (!chunk.data) {
209 return Status::Invalid("Expected another batch");
210 }
211 if (!batch->Equals(*chunk.data)) {
212 return Status::Invalid("Batch does not match");
213 }
214 }
215 ARROW_ASSIGN_OR_RAISE(chunk, reader->Next());
216 if (chunk.data || chunk.app_metadata) {
217 return Status::Invalid("Too many batches");
218 }
219
220 RETURN_NOT_OK(writer->WriteMetadata(Buffer::FromString("done")));
221 return Status::OK();
222}
223
224// Read some number of record batches from the client, send a
225// metadata message back with the count, then echo the batches back.

Callers

nothing calls this directly

Calls 9

ExampleIntSchemaFunction · 0.85
ExampleIntBatchesFunction · 0.85
FromStringFunction · 0.85
ARROW_ASSIGN_OR_RAISEFunction · 0.70
InvalidFunction · 0.50
OKFunction · 0.50
EqualsMethod · 0.45
NextMethod · 0.45
WriteMetadataMethod · 0.45

Tested by

no test coverage detected