| 134 | } |
| 135 | |
| 136 | arrow::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 | |
| 183 | struct SizedBatch { |
| 184 | std::shared_ptr<arrow::RecordBatch> batch; |
nothing calls this directly
no test coverage detected