| 223 | } |
| 224 | |
| 225 | void Suggest::fetch(IServerConnection & connection, const ConnectionTimeouts & timeouts, const std::string & query, const ClientInfo & client_info) |
| 226 | { |
| 227 | connection.sendQuery( |
| 228 | timeouts, query, {} /* query_parameters */, "" /* query_id */, QueryProcessingStage::Complete, nullptr, &client_info, false, {} /* external_roles*/, {}); |
| 229 | |
| 230 | while (true) |
| 231 | { |
| 232 | Packet packet = connection.receivePacket(); |
| 233 | switch (packet.type) |
| 234 | { |
| 235 | case Protocol::Server::Data: |
| 236 | fillWordsFromBlock(packet.block); |
| 237 | continue; |
| 238 | |
| 239 | case Protocol::Server::TimezoneUpdate: |
| 240 | case Protocol::Server::Progress: |
| 241 | case Protocol::Server::ProfileInfo: |
| 242 | case Protocol::Server::Totals: |
| 243 | case Protocol::Server::Extremes: |
| 244 | case Protocol::Server::Log: |
| 245 | case Protocol::Server::ProfileEvents: |
| 246 | continue; |
| 247 | |
| 248 | case Protocol::Server::Exception: |
| 249 | packet.exception->rethrow(); |
| 250 | return; |
| 251 | |
| 252 | case Protocol::Server::EndOfStream: |
| 253 | last_error = ErrorCodes::OK; |
| 254 | return; |
| 255 | |
| 256 | default: |
| 257 | throw Exception(ErrorCodes::UNKNOWN_PACKET_FROM_SERVER, "Unknown packet {} from server {}", |
| 258 | packet.type, connection.getDescription()); |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | void Suggest::fillWordsFromBlock(const Block & block) |
| 264 | { |
no test coverage detected