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

Function RunDoPutTest

cpp/src/arrow/flight/flight_benchmark.cc:241–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241arrow::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
273Status DoSinglePerfRun(FlightClient* client, const FlightClientOptions client_options,
274 const FlightCallOptions& call_options, bool test_put,

Callers

nothing calls this directly

Calls 7

AddLatencyMethod · 0.80
sizeMethod · 0.45
WriteRecordBatchMethod · 0.45
num_rowsMethod · 0.45
StartMethod · 0.45
StopMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected