mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
fix
This commit is contained in:
parent
3a1dd045dd
commit
7b487dd923
@ -16,6 +16,7 @@ namespace DB
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -37,8 +38,8 @@ void PrettyBlockOutputFormat::calculateWidths(
|
||||
{
|
||||
size_t num_rows = std::min(chunk.getNumRows(), format_settings.pretty.max_rows);
|
||||
|
||||
/// len(num_rows) + len(". ")
|
||||
row_number_width = static_cast<size_t>(std::floor(std::log10(num_rows))) + 3;
|
||||
/// len(num_rows + total_rows) + len(". ")
|
||||
row_number_width = static_cast<size_t>(std::floor(std::log10(num_rows + total_rows))) + 3;
|
||||
|
||||
size_t num_columns = chunk.getNumColumns();
|
||||
const auto & columns = chunk.getColumns();
|
||||
@ -296,6 +297,10 @@ void PrettyBlockOutputFormat::writeChunk(const Chunk & chunk, PortKind port_kind
|
||||
{
|
||||
// Write row number;
|
||||
auto row_num_string = std::to_string(i + 1 + total_rows) + ". ";
|
||||
size_t black_width = row_number_width - row_num_string.size();
|
||||
if (black_width > row_number_width)
|
||||
throw Exception(
|
||||
ErrorCodes::LOGICAL_ERROR, "blak width overflow {}, {}, {}", black_width, row_num_string.size(), row_number_width);
|
||||
for (size_t j = 0; j < row_number_width - row_num_string.size(); ++j)
|
||||
{
|
||||
writeCString(" ", out);
|
||||
|
@ -258,3 +258,235 @@
|
||||
a
|
||||
|
||||
2. 2
|
||||
┏━━━━━━━━┓
|
||||
┃ [1mnumber[0m ┃
|
||||
┡━━━━━━━━┩
|
||||
1. │ 0 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ [1mnumber[0m ┃
|
||||
┡━━━━━━━━┩
|
||||
2. │ 1 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ [1mnumber[0m ┃
|
||||
┡━━━━━━━━┩
|
||||
3. │ 2 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ [1mnumber[0m ┃
|
||||
┡━━━━━━━━┩
|
||||
4. │ 3 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ [1mnumber[0m ┃
|
||||
┡━━━━━━━━┩
|
||||
5. │ 4 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ [1mnumber[0m ┃
|
||||
┡━━━━━━━━┩
|
||||
6. │ 5 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ [1mnumber[0m ┃
|
||||
┡━━━━━━━━┩
|
||||
7. │ 6 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ [1mnumber[0m ┃
|
||||
┡━━━━━━━━┩
|
||||
8. │ 7 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ [1mnumber[0m ┃
|
||||
┡━━━━━━━━┩
|
||||
9. │ 8 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ [1mnumber[0m ┃
|
||||
┡━━━━━━━━┩
|
||||
10. │ 9 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
1. │ 0 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
2. │ 1 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
3. │ 2 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
4. │ 3 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
5. │ 4 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
6. │ 5 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
7. │ 6 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
8. │ 7 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
9. │ 8 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
10. │ 9 │
|
||||
└────────┘
|
||||
┌─[1mnumber[0m─┐
|
||||
1. │ 0 │
|
||||
2. │ 1 │
|
||||
3. │ 2 │
|
||||
4. │ 3 │
|
||||
5. │ 4 │
|
||||
6. │ 5 │
|
||||
7. │ 6 │
|
||||
8. │ 7 │
|
||||
9. │ 8 │
|
||||
10. │ 9 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ number ┃
|
||||
┡━━━━━━━━┩
|
||||
1. │ 0 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ number ┃
|
||||
┡━━━━━━━━┩
|
||||
2. │ 1 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ number ┃
|
||||
┡━━━━━━━━┩
|
||||
3. │ 2 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ number ┃
|
||||
┡━━━━━━━━┩
|
||||
4. │ 3 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ number ┃
|
||||
┡━━━━━━━━┩
|
||||
5. │ 4 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ number ┃
|
||||
┡━━━━━━━━┩
|
||||
6. │ 5 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ number ┃
|
||||
┡━━━━━━━━┩
|
||||
7. │ 6 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ number ┃
|
||||
┡━━━━━━━━┩
|
||||
8. │ 7 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ number ┃
|
||||
┡━━━━━━━━┩
|
||||
9. │ 8 │
|
||||
└────────┘
|
||||
┏━━━━━━━━┓
|
||||
┃ number ┃
|
||||
┡━━━━━━━━┩
|
||||
10. │ 9 │
|
||||
└────────┘
|
||||
┌─number─┐
|
||||
1. │ 0 │
|
||||
└────────┘
|
||||
┌─number─┐
|
||||
2. │ 1 │
|
||||
└────────┘
|
||||
┌─number─┐
|
||||
3. │ 2 │
|
||||
└────────┘
|
||||
┌─number─┐
|
||||
4. │ 3 │
|
||||
└────────┘
|
||||
┌─number─┐
|
||||
5. │ 4 │
|
||||
└────────┘
|
||||
┌─number─┐
|
||||
6. │ 5 │
|
||||
└────────┘
|
||||
┌─number─┐
|
||||
7. │ 6 │
|
||||
└────────┘
|
||||
┌─number─┐
|
||||
8. │ 7 │
|
||||
└────────┘
|
||||
┌─number─┐
|
||||
9. │ 8 │
|
||||
└────────┘
|
||||
┌─number─┐
|
||||
10. │ 9 │
|
||||
└────────┘
|
||||
[1mnumber[0m
|
||||
|
||||
1. 0
|
||||
[1mnumber[0m
|
||||
|
||||
2. 1
|
||||
[1mnumber[0m
|
||||
|
||||
3. 2
|
||||
[1mnumber[0m
|
||||
|
||||
4. 3
|
||||
[1mnumber[0m
|
||||
|
||||
5. 4
|
||||
[1mnumber[0m
|
||||
|
||||
6. 5
|
||||
[1mnumber[0m
|
||||
|
||||
7. 6
|
||||
[1mnumber[0m
|
||||
|
||||
8. 7
|
||||
[1mnumber[0m
|
||||
|
||||
9. 8
|
||||
[1mnumber[0m
|
||||
|
||||
10. 9
|
||||
number
|
||||
|
||||
1. 0
|
||||
number
|
||||
|
||||
2. 1
|
||||
number
|
||||
|
||||
3. 2
|
||||
number
|
||||
|
||||
4. 3
|
||||
number
|
||||
|
||||
5. 4
|
||||
number
|
||||
|
||||
6. 5
|
||||
number
|
||||
|
||||
7. 6
|
||||
number
|
||||
|
||||
8. 7
|
||||
number
|
||||
|
||||
9. 8
|
||||
number
|
||||
|
||||
10. 9
|
||||
|
@ -24,10 +24,10 @@ SELECT * FROM (SELECT 1 AS a UNION ALL SELECT 2 as a) ORDER BY a FORMAT PrettyCo
|
||||
SELECT * FROM (SELECT 1 AS a UNION ALL SELECT 2 as a) ORDER BY a FORMAT PrettySpace;
|
||||
SELECT * FROM (SELECT 1 AS a UNION ALL SELECT 2 as a) ORDER BY a FORMAT PrettySpaceNoEscapes;
|
||||
|
||||
-- SELECT * FROM numbers(10) ORDER BY number FORMAT Pretty;
|
||||
-- SELECT * FROM numbers(10) ORDER BY number FORMAT PrettyCompact;
|
||||
-- SELECT * FROM numbers(10) ORDER BY number FORMAT PrettyCompactMonoBlock;
|
||||
-- SELECT * FROM numbers(10) ORDER BY number FORMAT PrettyNoEscapes;
|
||||
-- SELECT * FROM numbers(10) ORDER BY number FORMAT PrettyCompactNoEscapes;
|
||||
-- SELECT * FROM numbers(10) ORDER BY number FORMAT PrettySpace
|
||||
-- SELECT * FROM numbers(10) ORDER BY number FORMAT PrettySpaceNoEscapes;
|
||||
SELECT * FROM numbers(10) ORDER BY number FORMAT Pretty;
|
||||
SELECT * FROM numbers(10) ORDER BY number FORMAT PrettyCompact;
|
||||
SELECT * FROM numbers(10) ORDER BY number FORMAT PrettyCompactMonoBlock;
|
||||
SELECT * FROM numbers(10) ORDER BY number FORMAT PrettyNoEscapes;
|
||||
SELECT * FROM numbers(10) ORDER BY number FORMAT PrettyCompactNoEscapes;
|
||||
SELECT * FROM numbers(10) ORDER BY number FORMAT PrettySpace;
|
||||
SELECT * FROM numbers(10) ORDER BY number FORMAT PrettySpaceNoEscapes;
|
||||
|
Loading…
Reference in New Issue
Block a user