MCPcopy Create free account
hub / github.com/ByConity/ByConity / initializePipeline

Method initializePipeline

src/QueryPlan/ReadStorageRowCountStep.cpp:38–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 return std::make_shared<ReadStorageRowCountStep>(output_stream->header, query, agg_desc, num_rows, is_final_agg, database_and_table);
37}
38void ReadStorageRowCountStep::initializePipeline(QueryPipeline & pipeline, const BuildQueryPipelineSettings & context)
39{
40 const auto & func = agg_desc.function;
41 const AggregateFunctionCount & agg_count = static_cast<const AggregateFunctionCount &>(*func);
42 Block output_header;
43 if (is_final_agg)
44 {
45 auto count_column = ColumnVector<UInt64>::create();
46 count_column->insertValue(num_rows);
47 output_header.insert({count_column->getPtr(), agg_count.getReturnType(), agg_desc.column_name});
48 }
49 else
50 {
51 std::vector<char> state(agg_count.sizeOfData());
52 AggregateDataPtr place = state.data();
53
54 agg_count.create(place);
55 SCOPE_EXIT_MEMORY_SAFE(agg_count.destroy(place));
56
57 agg_count.set(place, num_rows);
58 auto column = ColumnAggregateFunction::create(func);
59 column->insertFrom(place);
60
61 // AggregateFunction's argument type must keep same.
62 output_header.insert(
63 {std::move(column), std::make_shared<DataTypeAggregateFunction>(func, func->getArgumentTypes(), agg_desc.parameters), agg_desc.column_name});
64 }
65
66 auto istream = std::make_shared<OneBlockInputStream>(output_header);
67 auto pipe = Pipe(std::make_shared<SourceFromInputStream>(istream));
68
69 for (const auto & processor : pipe.getProcessors())
70 processors.emplace_back(processor);
71
72 pipeline.init(std::move(pipe));
73
74 if (context.context)
75 pipeline.addInterpreterContext(context.context);
76}
77
78void ReadStorageRowCountStep::toProto(Protos::ReadStorageRowCountStep & proto, bool) const
79{

Callers

nothing calls this directly

Calls 15

PipeClass · 0.70
createFunction · 0.50
insertValueMethod · 0.45
insertMethod · 0.45
getPtrMethod · 0.45
getReturnTypeMethod · 0.45
sizeOfDataMethod · 0.45
dataMethod · 0.45
createMethod · 0.45
destroyMethod · 0.45
setMethod · 0.45
insertFromMethod · 0.45

Tested by

no test coverage detected