Removing dependency on functions from client: bug fixes [#CLICKHOUSE-2].

This commit is contained in:
Alexey Milovidov 2017-07-12 03:41:14 +03:00 committed by alexey-milovidov
parent 976e47e1af
commit 24331a18f5
5 changed files with 12 additions and 4 deletions

View File

@ -148,7 +148,9 @@ static BlockOutputStreamPtr getOutputImpl(const String & name, WriteBuffer & buf
else if (name == "PrettyCompactMonoBlock")
{
BlockOutputStreamPtr dst = std::make_shared<PrettyCompactBlockOutputStream>(buf, false, settings.output_format_pretty_max_rows, context);
return std::make_shared<SquashingBlockOutputStream>(dst, settings.output_format_pretty_max_rows, 0);
auto res = std::make_shared<SquashingBlockOutputStream>(dst, settings.output_format_pretty_max_rows, 0);
res->disableFlush();
return res;
}
else if (name == "PrettySpace")
return std::make_shared<PrettySpaceBlockOutputStream>(buf, false, settings.output_format_pretty_max_rows, context);

View File

@ -60,7 +60,7 @@ void PrettyBlockOutputStream::calculateWidths(const Block & block, WidthsPerColu
{
{
WriteBufferFromString out(serialized_value);
elem.type->serializeTextEscaped(*elem.column, i, out);
elem.type->serializeTextEscaped(*elem.column, j, out);
}
widths[i][j] = UTF8::countCodePoints(reinterpret_cast<const UInt8 *>(serialized_value.data()), serialized_value.size());

View File

@ -44,7 +44,7 @@ protected:
const Context & context;
using Widths = PODArray<size_t>;
using WidthsPerColumn = PODArray<Widths>;
using WidthsPerColumn = std::vector<Widths>;
static void calculateWidths(const Block & block, WidthsPerColumn & widths, Widths & max_widths, Widths & name_widths);
void writeValueWithPadding(const ColumnWithTypeAndName & elem, size_t row_num, size_t value_width, size_t pad_to_width);

View File

@ -33,7 +33,8 @@ void SquashingBlockOutputStream::finalize()
void SquashingBlockOutputStream::flush()
{
finalize();
if (!disable_flush)
finalize();
output->flush();
}

View File

@ -20,6 +20,9 @@ public:
void writePrefix() override;
void writeSuffix() override;
/// Don't write blocks less than specified size even when flush method was called by user.
void disableFlush() { disable_flush = true; }
private:
BlockOutputStreamPtr output;
@ -27,6 +30,8 @@ private:
bool all_written = false;
void finalize();
bool disable_flush = false;
};
}