2018-05-23 20:19:33 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Processors/IProcessor.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2018-05-24 01:02:16 +00:00
|
|
|
/** Has arbitary non zero number of inputs and arbitary non zero number of outputs.
|
|
|
|
* All of them have the same structure.
|
|
|
|
*
|
|
|
|
* Pulls data from arbitary input (whenever it is ready) and pushes it to arbitary output (whenever is is not full).
|
|
|
|
* Doesn't do any heavy calculations.
|
|
|
|
* Doesn't preserve an order of data.
|
|
|
|
*
|
|
|
|
* Examples:
|
|
|
|
* - union data from multiple inputs to single output - to serialize data that was processed in parallel.
|
|
|
|
* - split data from single input to multiple outputs - to allow further parallel processing.
|
|
|
|
*/
|
2018-05-23 20:19:33 +00:00
|
|
|
class ResizeProcessor : public IProcessor
|
|
|
|
{
|
|
|
|
public:
|
2018-05-24 02:39:22 +00:00
|
|
|
/// TODO Check that there is non zero number of inputs and outputs.
|
2019-04-26 11:34:51 +00:00
|
|
|
ResizeProcessor(const Block & header, size_t num_inputs, size_t num_outputs)
|
2018-05-24 02:39:22 +00:00
|
|
|
: IProcessor(InputPorts(num_inputs, header), OutputPorts(num_outputs, header))
|
2019-04-26 11:34:51 +00:00
|
|
|
, current_input(inputs.begin())
|
|
|
|
, current_output(outputs.begin())
|
2018-05-24 02:39:22 +00:00
|
|
|
{
|
|
|
|
}
|
2018-05-23 20:19:33 +00:00
|
|
|
|
|
|
|
String getName() const override { return "Resize"; }
|
|
|
|
|
|
|
|
Status prepare() override;
|
2019-04-26 11:34:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
InputPorts::iterator current_input;
|
|
|
|
OutputPorts::iterator current_output;
|
2018-05-23 20:19:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|