aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/Formats/Impl/RawBLOBRowOutputFormat.cpp
blob: 947bf2858a622616f30adda51f51059820e8deba (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
#include <Processors/Formats/Impl/RawBLOBRowOutputFormat.h>
#include <Formats/FormatFactory.h>
#include <IO/WriteBuffer.h>

namespace DB
{


RawBLOBRowOutputFormat::RawBLOBRowOutputFormat(
    WriteBuffer & out_,
    const Block & header_)
    : IRowOutputFormat(header_, out_)
{
}


void RawBLOBRowOutputFormat::writeField(const IColumn & column, const ISerialization &, size_t row_num)
{
    if (!column.isNullAt(row_num))
    {
        auto value = column.getDataAt(row_num);
        out.write(value.data, value.size);
    }
}


void registerOutputFormatRawBLOB(FormatFactory & factory)
{
    factory.registerOutputFormat("RawBLOB", [](
        WriteBuffer & buf,
        const Block & sample,
        const FormatSettings &)
    {
        return std::make_shared<RawBLOBRowOutputFormat>(buf, sample);
    });
}

}