mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 11:32:03 +00:00
Fixed error in prev. revision [#CLICKHOUSE-2].
This commit is contained in:
parent
5e61a56743
commit
1908b2b5a5
@ -79,9 +79,13 @@ void PrettyBlockOutputStream::calculateWidths(const Block & block, WidthsPerColu
|
|||||||
|
|
||||||
/// And also calculate widths for names of columns.
|
/// And also calculate widths for names of columns.
|
||||||
{
|
{
|
||||||
const String & name = elem.name;
|
/// We need to obtain length in escaped form.
|
||||||
|
{
|
||||||
|
WriteBufferFromString out(serialized_value);
|
||||||
|
writeEscapedString(elem.name, out);
|
||||||
|
}
|
||||||
|
|
||||||
name_widths[i] = UTF8::countCodePoints(reinterpret_cast<const UInt8 *>(name.data()), name.size());
|
name_widths[i] = UTF8::countCodePoints(reinterpret_cast<const UInt8 *>(serialized_value.data()), serialized_value.size());
|
||||||
max_widths[i] = std::max(max_widths[i], name_widths[i]);
|
max_widths[i] = std::max(max_widths[i], name_widths[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <DataTypes/DataTypeString.h>
|
#include <DataTypes/DataTypeString.h>
|
||||||
#include <DataTypes/DataTypesNumber.h>
|
#include <DataTypes/DataTypesNumber.h>
|
||||||
#include <IO/WriteHelpers.h>
|
#include <IO/WriteHelpers.h>
|
||||||
|
#include <IO/WriteBufferFromString.h>
|
||||||
#include <DataStreams/VerticalRowOutputStream.h>
|
#include <DataStreams/VerticalRowOutputStream.h>
|
||||||
#include <Common/UTF8Helpers.h>
|
#include <Common/UTF8Helpers.h>
|
||||||
|
|
||||||
@ -19,11 +20,20 @@ VerticalRowOutputStream::VerticalRowOutputStream(
|
|||||||
Widths name_widths(columns);
|
Widths name_widths(columns);
|
||||||
size_t max_name_width = 0;
|
size_t max_name_width = 0;
|
||||||
|
|
||||||
|
String serialized_value;
|
||||||
|
|
||||||
for (size_t i = 0; i < columns; ++i)
|
for (size_t i = 0; i < columns; ++i)
|
||||||
{
|
{
|
||||||
/// Note that number of code points is just a rough approximation of visible string width.
|
/// Note that number of code points is just a rough approximation of visible string width.
|
||||||
const String & name = sample.getByPosition(i).name;
|
const String & name = sample.getByPosition(i).name;
|
||||||
name_widths[i] = UTF8::countCodePoints(reinterpret_cast<const UInt8 *>(name.data()), name.size());
|
|
||||||
|
{
|
||||||
|
/// We need to obtain length in escaped form.
|
||||||
|
WriteBufferFromString out(serialized_value);
|
||||||
|
writeEscapedString(name, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
name_widths[i] = UTF8::countCodePoints(reinterpret_cast<const UInt8 *>(serialized_value.data()), serialized_value.size());
|
||||||
|
|
||||||
if (name_widths[i] > max_name_width)
|
if (name_widths[i] > max_name_width)
|
||||||
max_name_width = name_widths[i];
|
max_name_width = name_widths[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user