MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / onFinish

Method onFinish

src/QueryPipeline/RemoteInserter.cpp:136–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134
135
136void RemoteInserter::onFinish()
137{
138 /// Empty block means end of data.
139 connection.sendData(Block(), /* name */"", /* scalar */false);
140
141 /// Wait for EndOfStream or Exception packet, skip Log packets.
142 while (true)
143 {
144 Packet packet = connection.receivePacket();
145
146 if (Protocol::Server::EndOfStream == packet.type)
147 break;
148
149 if (Protocol::Server::Exception == packet.type)
150 packet.exception->rethrow();
151 else if (Protocol::Server::Log == packet.type ||
152 Protocol::Server::Progress == packet.type ||
153 Protocol::Server::ProfileEvents == packet.type ||
154 Protocol::Server::TimezoneUpdate == packet.type)
155 {
156 // Do nothing
157 }
158 else
159 throw NetException(
160 ErrorCodes::UNEXPECTED_PACKET_FROM_SERVER,
161 "Unexpected packet from server (expected EndOfStream or Exception, got {})",
162 Protocol::Server::toString(packet.type));
163 }
164
165 finished = true;
166}
167
168RemoteInserter::~RemoteInserter()
169{

Callers

nothing calls this directly

Calls 6

NetExceptionClass · 0.85
BlockClass · 0.70
toStringFunction · 0.50
sendDataMethod · 0.45
receivePacketMethod · 0.45
rethrowMethod · 0.45

Tested by

no test coverage detected