JSONCompactRowOutputFormat.h 1.2 KB
Newer Older
N
Nikolai Kochetov 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
#pragma once

#include <Core/Block.h>
#include <IO/WriteBuffer.h>
#include <IO/WriteBufferValidUTF8.h>
#include <Processors/Formats/Impl/JSONRowOutputFormat.h>


namespace DB
{

struct FormatSettings;

H
hcz 已提交
14
/** The stream for outputting data in the JSONCompact- formats.
N
Nikolai Kochetov 已提交
15 16 17 18
  */
class JSONCompactRowOutputFormat : public JSONRowOutputFormat
{
public:
H
hcz 已提交
19 20 21
    JSONCompactRowOutputFormat(
        WriteBuffer & out_,
        const Block & header,
22
        const RowOutputFormatParams & params_,
H
hcz 已提交
23 24
        const FormatSettings & settings_,
        bool yield_strings_);
N
Nikolai Kochetov 已提交
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

    String getName() const override { return "JSONCompactRowOutputFormat"; }

    void writeField(const IColumn & column, const IDataType & type, size_t row_num) override;
    void writeFieldDelimiter() override;
    void writeRowStartDelimiter() override;
    void writeRowEndDelimiter() override;

    void writeBeforeTotals() override;
    void writeAfterTotals() override;

protected:
    void writeExtremesElement(const char * title, const Columns & columns, size_t row_num) override;

    void writeTotalsField(const IColumn & column, const IDataType & type, size_t row_num) override
    {
        return writeField(column, type, row_num);
    }
43 44

    void writeTotalsFieldDelimiter() override;
N
Nikolai Kochetov 已提交
45 46 47
};

}