blob: 0ad12f6cd6595822cc591a20f2d4ee671e512f4e (
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
|
#pragma once
#include <Processors/IProcessor.h>
namespace DB
{
/// Transform which can generate several chunks on every consumed.
/// It can be assumed that class is used in following way:
///
/// for (chunk : input_chunks)
/// {
/// transform.consume(chunk);
///
/// while (transform.canGenerate())
/// {
/// transformed_chunk = transform.generate();
/// ... (process transformed chunk)
/// }
/// }
///
class IInflatingTransform : public IProcessor
{
protected:
InputPort & input;
OutputPort & output;
Chunk current_chunk;
bool has_input = false;
bool generated = false;
bool can_generate = false;
virtual void consume(Chunk chunk) = 0;
virtual bool canGenerate() = 0;
virtual Chunk generate() = 0;
public:
IInflatingTransform(Block input_header, Block output_header);
Status prepare() override;
void work() override;
InputPort & getInputPort() { return input; }
OutputPort & getOutputPort() { return output; }
};
}
|