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
48
49
50
51
52
53
54
55
56
57
|
#include <Processors/Formats/Impl/ValuesRowOutputFormat.h>
#include <Formats/FormatFactory.h>
#include <IO/WriteHelpers.h>
#include <Columns/IColumn.h>
#include <DataTypes/IDataType.h>
namespace DB
{
ValuesRowOutputFormat::ValuesRowOutputFormat(WriteBuffer & out_, const Block & header_, const FormatSettings & format_settings_)
: IRowOutputFormat(header_, out_), format_settings(format_settings_)
{
}
void ValuesRowOutputFormat::writeField(const IColumn & column, const ISerialization & serialization, size_t row_num)
{
serialization.serializeTextQuoted(column, row_num, out, format_settings);
}
void ValuesRowOutputFormat::writeFieldDelimiter()
{
writeChar(',', out);
}
void ValuesRowOutputFormat::writeRowStartDelimiter()
{
writeChar('(', out);
}
void ValuesRowOutputFormat::writeRowEndDelimiter()
{
writeChar(')', out);
}
void ValuesRowOutputFormat::writeRowBetweenDelimiter()
{
writeCString(",", out);
}
void registerOutputFormatValues(FormatFactory & factory)
{
factory.registerOutputFormat("Values", [](
WriteBuffer & buf,
const Block & sample,
const FormatSettings & settings)
{
return std::make_shared<ValuesRowOutputFormat>(buf, sample, settings);
});
factory.markOutputFormatSupportsParallelFormatting("Values");
}
}
|