| 239 | } |
| 240 | |
| 241 | arrow::Result<PerformanceResult> RunDoPutTest(FlightClient* client, |
| 242 | const FlightCallOptions& call_options, |
| 243 | const perf::Token& token, |
| 244 | const FlightEndpoint& endpoint, |
| 245 | PerformanceStats* stats) { |
| 246 | ARROW_ASSIGN_OR_RAISE(const auto batches, GetPutData(token)); |
| 247 | StopWatch timer; |
| 248 | int64_t num_records = 0; |
| 249 | int64_t num_bytes = 0; |
| 250 | ARROW_ASSIGN_OR_RAISE( |
| 251 | auto do_put_result, |
| 252 | client->DoPut(call_options, FlightDescriptor{}, batches[0].batch->schema())); |
| 253 | std::unique_ptr<FlightStreamWriter> writer = std::move(do_put_result.writer); |
| 254 | for (size_t i = 0; i < batches.size(); i++) { |
| 255 | auto batch = batches[i]; |
| 256 | auto is_last = i == (batches.size() - 1); |
| 257 | if (is_last) { |
| 258 | RETURN_NOT_OK(writer->WriteRecordBatch(*batch.batch)); |
| 259 | num_records += batch.batch->num_rows(); |
| 260 | num_bytes += batch.bytes; |
| 261 | } else { |
| 262 | timer.Start(); |
| 263 | RETURN_NOT_OK(writer->WriteRecordBatch(*batch.batch)); |
| 264 | stats->AddLatency(timer.Stop()); |
| 265 | num_records += batch.batch->num_rows(); |
| 266 | num_bytes += batch.bytes; |
| 267 | } |
| 268 | } |
| 269 | RETURN_NOT_OK(writer->Close()); |
| 270 | return PerformanceResult{static_cast<int64_t>(batches.size()), num_records, num_bytes}; |
| 271 | } |
| 272 | |
| 273 | Status DoSinglePerfRun(FlightClient* client, const FlightClientOptions client_options, |
| 274 | const FlightCallOptions& call_options, bool test_put, |
nothing calls this directly
no test coverage detected