blob: b2378e62d349a5fff1c073049d80c10f1c3113ba (
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
|
#include <Processors/Formats/PullingOutputFormat.h>
#include <IO/WriteBuffer.h>
namespace DB
{
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
}
WriteBufferFromPointer PullingOutputFormat::out(nullptr, 0);
PullingOutputFormat::PullingOutputFormat(const Block & header, std::atomic_bool & consume_data_flag_)
: IOutputFormat(header, out)
, has_data_flag(consume_data_flag_)
{}
void PullingOutputFormat::consume(Chunk chunk)
{
if (data)
throw Exception(ErrorCodes::LOGICAL_ERROR, "PullingOutputFormat cannot consume chunk because it already has data");
if (chunk)
info.update(chunk.getNumRows(), chunk.allocatedBytes());
data = std::move(chunk);
has_data_flag = true;
}
Chunk PullingOutputFormat::getChunk()
{
auto chunk = std::move(data);
has_data_flag = false;
return chunk;
}
Chunk PullingOutputFormat::getTotals() { return std::move(totals); }
Chunk PullingOutputFormat::getExtremes() { return std::move(extremes); }
void PullingOutputFormat::setRowsBeforeLimit(size_t rows_before_limit)
{
info.setRowsBeforeLimit(rows_before_limit);
}
}
|