aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/Formats/Impl/TSKVRowOutputFormat.h
blob: 25613dd22d93e8f2618f48d6d6aaeede8aa54545 (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
#pragma once

#include <Formats/FormatSettings.h>
#include <Processors/Formats/Impl/TabSeparatedRowOutputFormat.h>


namespace DB
{

/** The stream for outputting data in the TSKV format.
  * TSKV is similar to TabSeparated, but before every value, its name and equal sign are specified: name=value.
  * This format is very inefficient.
  */
class TSKVRowOutputFormat final : public TabSeparatedRowOutputFormat
{
public:
    TSKVRowOutputFormat(WriteBuffer & out_, const Block & header, const FormatSettings & format_settings);

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

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

    /// Disable totals and extremes, because they are enabled in TSV.
    bool supportTotals() const override { return false; }
    bool supportExtremes() const override { return false; }

    NamesAndTypes fields;
    size_t field_number = 0;
};

}