From f047a28ed82fa827307b64dce66c8fb1eee3be10 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 3 Feb 2022 04:48:52 +0300 Subject: [PATCH 1/2] Fix progress bar width --- src/Common/ProgressIndication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Common/ProgressIndication.cpp b/src/Common/ProgressIndication.cpp index b9a8bc923f74..00e2326b0b45 100644 --- a/src/Common/ProgressIndication.cpp +++ b/src/Common/ProgressIndication.cpp @@ -243,7 +243,7 @@ void ProgressIndication::writeProgress() if (width_of_progress_bar > 0) { - size_t bar_width = UnicodeBar::getWidth(current_count, 0, max_count, width_of_progress_bar); + double bar_width = UnicodeBar::getWidth(current_count, 0, max_count, width_of_progress_bar); std::string bar = UnicodeBar::render(bar_width); /// Render profiling_msg at left on top of the progress bar. From 6d470319aeeae6a2963830729b86519eee427bcb Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 3 Feb 2022 05:26:00 +0300 Subject: [PATCH 2/2] Add a test --- .../02204_fractional_progress_bar.reference | 0 .../02204_fractional_progress_bar.sh | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/queries/0_stateless/02204_fractional_progress_bar.reference create mode 100755 tests/queries/0_stateless/02204_fractional_progress_bar.sh diff --git a/tests/queries/0_stateless/02204_fractional_progress_bar.reference b/tests/queries/0_stateless/02204_fractional_progress_bar.reference new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/queries/0_stateless/02204_fractional_progress_bar.sh b/tests/queries/0_stateless/02204_fractional_progress_bar.sh new file mode 100755 index 000000000000..6018ee8c96c1 --- /dev/null +++ b/tests/queries/0_stateless/02204_fractional_progress_bar.sh @@ -0,0 +1,20 @@ +#!/usr/bin/expect -f +# Tags: no-fasttest + +log_user 0 +set timeout 60 +match_max 100000 + +spawn clickhouse-local --progress --query "SELECT sum(number % 100000000 = 12345678 ? sleep(0.1) : 1) FROM numbers(1000000000)" + +expect { + "▏" { exit 0 } + "▎" { exit 0 } + "▍" { exit 0 } + "▌" { exit 0 } + "▋" { exit 0 } + "▋" { exit 0 } + "▊" { exit 0 } + "▉" { exit 0 } + timeout { exit 1 } +}