mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Fix sending progress.
This commit is contained in:
parent
4f0405af93
commit
98e2cc4117
@ -625,6 +625,7 @@ namespace
|
||||
{
|
||||
finalize = true;
|
||||
io.onFinish();
|
||||
addProgressToResult();
|
||||
query_scope->logPeakMemoryUsage();
|
||||
addLogsToResult();
|
||||
sendResult();
|
||||
@ -730,8 +731,10 @@ namespace
|
||||
|
||||
void Call::addProgressToResult()
|
||||
{
|
||||
auto & grpc_progress = *result.mutable_progress();
|
||||
auto values = progress.fetchAndResetPiecewiseAtomically();
|
||||
if (!values.read_rows && !values.read_bytes && !values.total_rows_to_read && !values.written_rows && !values.written_bytes)
|
||||
return;
|
||||
auto & grpc_progress = *result.mutable_progress();
|
||||
grpc_progress.set_read_rows(values.read_rows);
|
||||
grpc_progress.set_read_bytes(values.read_bytes);
|
||||
grpc_progress.set_total_rows_to_read(values.total_rows_to_read);
|
||||
|
@ -178,3 +178,30 @@ def test_logs():
|
||||
assert "SELECT 1" in logs
|
||||
assert "Read 1 rows" in logs
|
||||
assert "Peak memory usage" in logs
|
||||
|
||||
def test_progress():
|
||||
results = query_no_errors("SELECT number, sleep(0.31) FROM numbers(8) SETTINGS max_block_size=2, interactive_delay=100000")
|
||||
#print(results)
|
||||
assert str(results) ==\
|
||||
"""[progress {
|
||||
read_rows: 2
|
||||
read_bytes: 16
|
||||
total_rows_to_read: 8
|
||||
}
|
||||
, output: "0\\t0\\n1\\t0\\n"
|
||||
, progress {
|
||||
read_rows: 2
|
||||
read_bytes: 16
|
||||
}
|
||||
, output: "2\\t0\\n3\\t0\\n"
|
||||
, progress {
|
||||
read_rows: 2
|
||||
read_bytes: 16
|
||||
}
|
||||
, output: "4\\t0\\n5\\t0\\n"
|
||||
, progress {
|
||||
read_rows: 2
|
||||
read_bytes: 16
|
||||
}
|
||||
, output: "6\\t0\\n7\\t0\\n"
|
||||
, ]"""
|
||||
|
Loading…
Reference in New Issue
Block a user