2019-02-19 18:41:18 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Processors/Formats/Impl/PrettyBlockOutputFormat.h>
|
2020-08-05 22:43:23 +00:00
|
|
|
#include <optional>
|
|
|
|
#include <unordered_map>
|
2019-02-19 18:41:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/** Prints the result in the form of beautiful tables, but with fewer delimiter lines.
|
|
|
|
*/
|
|
|
|
class PrettyCompactBlockOutputFormat : public PrettyBlockOutputFormat
|
|
|
|
{
|
|
|
|
public:
|
2020-08-05 22:43:23 +00:00
|
|
|
PrettyCompactBlockOutputFormat(WriteBuffer & out_, const Block & header, const FormatSettings & format_settings_, bool mono_block_);
|
2019-02-19 18:41:18 +00:00
|
|
|
String getName() const override { return "PrettyCompactBlockOutputFormat"; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void write(const Chunk & chunk, PortKind port_kind) override;
|
|
|
|
void writeHeader(const Block & block, const Widths & max_widths, const Widths & name_widths);
|
|
|
|
void writeBottom(const Widths & max_widths);
|
|
|
|
void writeRow(
|
|
|
|
size_t row_num,
|
|
|
|
const Block & header,
|
|
|
|
const Columns & columns,
|
|
|
|
const WidthsPerColumn & widths,
|
|
|
|
const Widths & max_widths);
|
2020-08-05 22:43:23 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool mono_block;
|
|
|
|
/// For mono_block == true only
|
|
|
|
Chunk mono_chunk;
|
|
|
|
|
|
|
|
void writeChunk(const Chunk & chunk, PortKind port_kind);
|
|
|
|
void writeSuffixIfNot() override;
|
2019-02-19 18:41:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|