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

Function RunDoGetTest

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

Source from the content-addressed store, hash-verified

134}
135
136arrow::Result<PerformanceResult> RunDoGetTest(FlightClient* client,
137 const FlightCallOptions& call_options,
138 const perf::Token& token,
139 const FlightEndpoint& endpoint,
140 PerformanceStats* stats) {
141 std::unique_ptr<FlightStreamReader> reader;
142 ARROW_ASSIGN_OR_RAISE(reader, client->DoGet(call_options, endpoint.ticket));
143
144 FlightStreamChunk batch;
145
146 // This is hard-coded for right now, 4 columns each with int64
147 const int bytes_per_record = 32;
148
149 // This must also be set in perf_server.cc
150 const bool verify = false;
151
152 int64_t num_bytes = 0;
153 int64_t num_records = 0;
154 int64_t num_batches = 0;
155 StopWatch timer;
156 while (true) {
157 timer.Start();
158 ARROW_ASSIGN_OR_RAISE(batch, reader->Next());
159 stats->AddLatency(timer.Stop());
160 if (!batch.data) {
161 break;
162 }
163
164 if (verify) {
165 auto values = batch.data->column_data(0)->GetValues<int64_t>(1);
166 const int64_t start = token.start() + num_records;
167 for (int64_t i = 0; i < batch.data->num_rows(); ++i) {
168 if (values[i] != start + i) {
169 return Status::Invalid("verification failure");
170 }
171 }
172 }
173
174 ++num_batches;
175 num_records += batch.data->num_rows();
176
177 // Hard-coded
178 num_bytes += batch.data->num_rows() * bytes_per_record;
179 }
180 return PerformanceResult{num_batches, num_records, num_bytes};
181}
182
183struct SizedBatch {
184 std::shared_ptr<arrow::RecordBatch> batch;

Callers

nothing calls this directly

Calls 10

AddLatencyMethod · 0.80
column_dataMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
InvalidFunction · 0.50
DoGetMethod · 0.45
StartMethod · 0.45
NextMethod · 0.45
StopMethod · 0.45
startMethod · 0.45
num_rowsMethod · 0.45

Tested by

no test coverage detected