forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPort.cpp
More file actions
27 lines (21 loc) · 703 Bytes
/
Copy pathPort.cpp
File metadata and controls
27 lines (21 loc) · 703 Bytes
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
#include <Processors/Port.h>
#include <Processors/IProcessor.h>
namespace DB
{
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
}
void connect(OutputPort & output, InputPort & input)
{
if (input.state || output.state)
throw Exception("Port is already connected", ErrorCodes::LOGICAL_ERROR);
auto out_name = output.getProcessor().getName();
auto in_name = input.getProcessor().getName();
assertCompatibleHeader(output.getHeader(), input.getHeader(), " function connect between " + out_name + " and " + in_name);
input.output_port = &output;
output.input_port = &input;
input.state = std::make_shared<Port::State>();
output.state = input.state;
}
}