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

#include <Processors/Formats/IRowInputFormat.h>
#include <Processors/Formats/ISchemaReader.h>
#include <DataTypes/DataTypeString.h>


namespace DB
{

class ReadBuffer;

/// This format slurps all input data into single value.
/// This format can only parse a table with single field of type String or similar.

class RawBLOBRowInputFormat final : public IRowInputFormat
{
public:
    RawBLOBRowInputFormat(const Block & header_, ReadBuffer & in_, Params params_);

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

private:
    bool readRow(MutableColumns & columns, RowReadExtension &) override;

    bool supportsCountRows() const override { return true; }
    size_t countRows(size_t max_block_size) override;

    bool done_count_rows = false;
};

class RawBLOBSchemaReader: public IExternalSchemaReader
{
public:
    NamesAndTypesList readSchema() override
    {
        return {{"raw_blob", std::make_shared<DataTypeString>()}};
    }
};

}