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

Method addPerStreamLimitByIfNeeded

src/Processors/QueryPlan/SortingStep.cpp:280–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280void SortingStep::addPerStreamLimitByIfNeeded(QueryPipelineBuilder & pipeline, const SortDescription & stream_sort_desc)
281{
282 if (limit_by_columns.empty() || pipeline.getNumStreams() <= 1)
283 return;
284
285 if (getCollationAwareSortPrefixInColumns(stream_sort_desc, limit_by_columns).size() != limit_by_columns.size())
286 return;
287
288 pipeline.addSimpleTransform(
289 [&](const SharedHeader & header, QueryPipelineBuilder::StreamType stream_type) -> ProcessorPtr
290 {
291 if (stream_type != QueryPipelineBuilder::StreamType::Main)
292 return nullptr;
293 return std::make_shared<LimitBySortedStreamTransform>(header, limit_by_group_length, 0, limit_by_columns);
294 });
295}
296
297void SortingStep::updateLimit(size_t limit_)
298{

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.45
getNumStreamsMethod · 0.45
sizeMethod · 0.45
addSimpleTransformMethod · 0.45

Tested by

no test coverage detected