ClickHouse/dbms/Processors/Port.cpp

28 lines
711 B
C++
Raw Normal View History

#include <Processors/Port.h>
2019-04-11 15:31:23 +00:00
#include <Processors/IProcessor.h>
namespace DB
{
2020-02-25 18:10:48 +00:00
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
}
void connect(OutputPort & output, InputPort & input)
{
if (input.state || output.state)
2019-02-05 13:01:40 +00:00
throw Exception("Port is already connected", ErrorCodes::LOGICAL_ERROR);
2019-04-11 15:31:23 +00:00
auto out_name = output.getProcessor().getName();
auto in_name = input.getProcessor().getName();
assertBlocksHaveEqualStructure(input.getHeader(), output.getHeader(), " function connect between " + out_name + " and " + in_name);
2019-04-11 14:44:20 +00:00
input.output_port = &output;
output.input_port = &input;
input.state = std::make_shared<Port::State>();
output.state = input.state;
}
}