blob: 2be39669dd2a5619858c9904c7ee561582a2ea3e (
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
45
46
47
|
#pragma once
#include <Core/Block.h>
#include <IO/WriteBuffer.h>
#include <Processors/Formats/OutputFormatWithUTF8ValidationAdaptor.h>
#include <Formats/FormatSettings.h>
namespace DB
{
/** The stream for outputting data in JSON format, by object per line.
*/
class JSONCompactEachRowRowOutputFormat final : public RowOutputFormatWithUTF8ValidationAdaptor
{
public:
JSONCompactEachRowRowOutputFormat(
WriteBuffer & out_,
const Block & header_,
const FormatSettings & settings_,
bool with_names_,
bool with_types_,
bool yield_strings_);
String getName() const override { return "JSONCompactEachRowRowOutputFormat"; }
private:
void writePrefix() override;
void writeTotals(const Columns & columns, size_t row_num) override;
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; }
void consumeTotals(Chunk) override;
void writeLine(const std::vector<String> & values);
FormatSettings settings;
bool with_names;
bool with_types;
bool yield_strings;
};
}
|