Suppress output of cancelled queries in clickhouse-client #9473

This commit is contained in:
Alexey Milovidov 2020-06-01 21:58:38 +03:00
parent 4df6d41457
commit 7989e945e6

View File

@ -1178,7 +1178,7 @@ private:
break;
}
if (!receiveAndProcessPacket())
if (!receiveAndProcessPacket(cancelled))
break;
}
@ -1189,13 +1189,15 @@ private:
/// Receive a part of the result, or progress info or an exception and process it.
/// Returns true if one should continue receiving packets.
bool receiveAndProcessPacket()
/// Output of result is suppressed if query was cancelled.
bool receiveAndProcessPacket(bool cancelled)
{
Packet packet = connection->receivePacket();
switch (packet.type)
{
case Protocol::Server::Data:
if (!cancelled)
onData(packet.block);
return true;
@ -1208,10 +1210,12 @@ private:
return true;
case Protocol::Server::Totals:
if (!cancelled)
onTotals(packet.block);
return true;
case Protocol::Server::Extremes:
if (!cancelled)
onExtremes(packet.block);
return true;
@ -1304,7 +1308,7 @@ private:
while (packet_type && *packet_type == Protocol::Server::Log)
{
receiveAndProcessPacket();
receiveAndProcessPacket(false);
packet_type = connection->checkPacket();
}
}