| 111 | #endif |
| 112 | |
| 113 | Status PrintResultsForEndpoint(FlightSqlClient& client, |
| 114 | const FlightCallOptions& call_options, |
| 115 | const FlightEndpoint& endpoint) { |
| 116 | ARROW_ASSIGN_OR_RAISE(auto stream, client.DoGet(call_options, endpoint.ticket)); |
| 117 | |
| 118 | const arrow::Result<std::shared_ptr<Schema>>& schema = stream->GetSchema(); |
| 119 | ARROW_RETURN_NOT_OK(schema); |
| 120 | |
| 121 | std::cout << "Schema:" << std::endl; |
| 122 | std::cout << schema->get()->ToString() << std::endl << std::endl; |
| 123 | |
| 124 | std::cout << "Results:" << std::endl; |
| 125 | |
| 126 | int64_t num_rows = 0; |
| 127 | |
| 128 | while (true) { |
| 129 | ARROW_ASSIGN_OR_RAISE(FlightStreamChunk chunk, stream->Next()); |
| 130 | if (chunk.data == nullptr) { |
| 131 | break; |
| 132 | } |
| 133 | std::cout << chunk.data->ToString() << std::endl; |
| 134 | num_rows += chunk.data->num_rows(); |
| 135 | } |
| 136 | |
| 137 | std::cout << "Total: " << num_rows << std::endl; |
| 138 | |
| 139 | return Status::OK(); |
| 140 | } |
| 141 | |
| 142 | Status PrintResults(FlightSqlClient& client, const FlightCallOptions& call_options, |
| 143 | const std::unique_ptr<FlightInfo>& info) { |