aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/Formats/Impl/JSONCompactRowOutputFormat.h
blob: d10075f8834bad9a4f3d9b6acf7f7f5ce5029d81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once

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


namespace DB
{

struct FormatSettings;

/** The stream for outputting data in the JSONCompact- formats.
  */
class JSONCompactRowOutputFormat final : public JSONRowOutputFormat
{
public:
    JSONCompactRowOutputFormat(
        WriteBuffer & out_,
        const Block & header,
        const FormatSettings & settings_,
        bool yield_strings_);

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

private:
    void writeField(const IColumn & column, const ISerialization & serialization, size_t row_num) override;
    void writeFieldDelimiter() override;
    void writeRowStartDelimiter() override;
    void writeRowEndDelimiter() override;

    bool supportTotals() const override { return true; }
    bool supportExtremes() const override { return true; }

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

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

    void writeTotals(const Columns & columns, size_t row_num) override;
};

}