blob: d20d4d9974722de6712a39b54fae04f632135df7 (
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
48
49
50
51
52
53
54
55
|
#pragma once
#include "clickhouse_config.h"
#if USE_CAPNP
# include <Formats/CapnProtoSchema.h>
# include <Formats/CapnProtoSerializer.h>
# include <Formats/FormatSchemaInfo.h>
# include <Processors/Formats/IRowOutputFormat.h>
# error #include <capnp/dynamic.h>
# error #include <capnp/schema.h>
# error #include <kj/io.h>
namespace DB
{
class CapnProtoOutputStream : public kj::OutputStream
{
public:
explicit CapnProtoOutputStream(WriteBuffer & out_);
void write(const void * buffer, size_t size) override;
private:
WriteBuffer & out;
};
class CapnProtoRowOutputFormat final : public IRowOutputFormat
{
public:
CapnProtoRowOutputFormat(
WriteBuffer & out_,
const Block & header_,
const CapnProtoSchemaInfo & info,
const FormatSettings & format_settings);
String getName() const override { return "CapnProtoRowOutputFormat"; }
private:
void write(const Columns & columns, size_t row_num) override;
void writeField(const IColumn &, const ISerialization &, size_t) override { }
Names column_names;
DataTypes column_types;
capnp::StructSchema schema;
std::unique_ptr<CapnProtoOutputStream> output_stream;
CapnProtoSchemaParser schema_parser;
std::unique_ptr<CapnProtoSerializer> serializer;
};
}
#endif // USE_CAPNP
|