MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / narrowPipe

Function narrowPipe

src/QueryPipeline/narrowPipe.cpp:28–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28void narrowPipe(Pipe & pipe, size_t width)
29{
30 size_t size = pipe.numOutputPorts();
31 if (size <= width)
32 return;
33
34 VectorWithMemoryTracking<OutputPortRawPtrs> partitions(width);
35
36 auto distribution = getDistribution(size, width);
37
38 pipe.transform([&](const OutputPortRawPtrs & ports)
39 {
40 for (size_t i = 0; i < size; ++i)
41 partitions[distribution[i]].emplace_back(ports[i]);
42
43 Processors concats;
44
45 for (size_t i = 0; i < width; ++i)
46 {
47 auto concat = std::make_shared<ConcatProcessor>(partitions[i].at(0)->getSharedHeader(),
48 partitions[i].size());
49 size_t next_port = 0;
50 for (auto & port : concat->getInputs())
51 {
52 connect(*partitions[i][next_port], port);
53 ++next_port;
54 }
55
56 concats.emplace_back(std::move(concat));
57 }
58
59 return concats;
60 });
61}
62
63}

Callers 1

narrowMethod · 0.85

Calls 8

getDistributionFunction · 0.85
connectFunction · 0.85
numOutputPortsMethod · 0.80
getSharedHeaderMethod · 0.80
transformMethod · 0.45
emplace_backMethod · 0.45
atMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected