| 1 | #pragma once | 
|---|
| 2 |  | 
|---|
| 3 | #include <Processors/IProcessor.h> | 
|---|
| 4 |  | 
|---|
| 5 |  | 
|---|
| 6 | namespace DB | 
|---|
| 7 | { | 
|---|
| 8 |  | 
|---|
| 9 | /** Has one input and arbitrary non zero number of outputs. | 
|---|
| 10 | * All of them have the same structure. | 
|---|
| 11 | * | 
|---|
| 12 | * Pulls data input and copies it to every output. | 
|---|
| 13 | * You may have heard about it under the name 'tee'. | 
|---|
| 14 | * | 
|---|
| 15 | * Doesn't do any heavy calculations. | 
|---|
| 16 | * Preserves an order of data. | 
|---|
| 17 | */ | 
|---|
| 18 | class ForkProcessor : public IProcessor | 
|---|
| 19 | { | 
|---|
| 20 | public: | 
|---|
| 21 | ForkProcessor(const Block & , size_t num_outputs) | 
|---|
| 22 | : IProcessor(InputPorts{header}, OutputPorts(num_outputs, header)) | 
|---|
| 23 | { | 
|---|
| 24 | } | 
|---|
| 25 |  | 
|---|
| 26 | String getName() const override { return "Fork"; } | 
|---|
| 27 |  | 
|---|
| 28 | Status prepare() override; | 
|---|
| 29 |  | 
|---|
| 30 | InputPort & getInputPort() { return inputs.front(); } | 
|---|
| 31 | }; | 
|---|
| 32 |  | 
|---|
| 33 | } | 
|---|
| 34 |  | 
|---|
| 35 |  | 
|---|
| 36 |  | 
|---|