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

Method initializePipeline

src/QueryPlan/TableScanStep.cpp:1149–1651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1147}
1148
1149void TableScanStep::initializePipeline(QueryPipeline & pipeline, const BuildQueryPipelineSettings & build_context)
1150{
1151 if (is_null_source)
1152 {
1153 LOG_DEBUG(log, "Create NullSource from TableScanStep without storage");
1154 pipeline.init(Pipe(std::make_shared<NullSource>(output_stream->header)));
1155 return;
1156 }
1157 auto * query = query_info.query->as<ASTSelectQuery>();
1158 bool use_expand_pipe = build_context.is_expand;
1159 if (!build_context.is_expand && (query->getWhere() || query->getPrewhere() || query_info.partition_filter)
1160 && build_context.context->getSettingsRef().enable_runtime_filter_pipeline_poll)
1161 {
1162 std::vector<RuntimeFilterId> ids;
1163 if (query->getWhere())
1164 {
1165 auto where_ids = RuntimeFilterUtils::extractRuntimeFilterId(query->getWhere());
1166 ids.insert(ids.end(), where_ids.begin(), where_ids.end());
1167 }
1168 if (query->getPrewhere())
1169 {
1170 auto prewhere_ids = RuntimeFilterUtils::extractRuntimeFilterId(query->getPrewhere());
1171 ids.insert(ids.end(), prewhere_ids.begin(), prewhere_ids.end());
1172 }
1173
1174 if (query_info.partition_filter)
1175 {
1176 auto prewhere_ids = RuntimeFilterUtils::extractRuntimeFilterId(query_info.partition_filter);
1177 ids.insert(ids.end(), prewhere_ids.begin(), prewhere_ids.end());
1178 }
1179
1180 if (!ids.empty())
1181 {
1182 Pipe pipe(std::make_shared<MergeTreeSelectPrepareProcessor>(
1183 *this,
1184 build_context,
1185 table_output_stream.header,
1186 std::move(ids),
1187 build_context.context->getSettingsRef().wait_runtime_filter_timeout));
1188 pipeline.init(std::move(pipe));
1189 pipeline.addTransform(std::make_shared<ResizeProcessor>(
1190 table_output_stream.header, 1, build_context.context->getSettingsRef().max_threads));
1191 return;
1192 }
1193 }
1194
1195 Stopwatch stage_watch, total_watch;
1196 total_watch.start();
1197 stage_watch.start();
1198 storage = DatabaseCatalog::instance().getTable(storage_id, build_context.context);
1199
1200 auto * merge_tree_storage = dynamic_cast<MergeTreeMetaBase *>(storage.get());
1201 bool is_merge_tree = merge_tree_storage != nullptr;
1202
1203 bool use_projection_index = build_context.context->getSettingsRef().optimizer_index_projection_support && is_merge_tree
1204 && build_context.context->getSettingsRef().enable_ab_index_optimization;
1205
1206 bool use_optimizer_projection_selection

Callers

nothing calls this directly

Calls 15

queryToStringFunction · 0.85
TableScanExecutorClass · 0.85
getWhereMethod · 0.80
getQueryInfoMethod · 0.80
dumpDAGMethod · 0.80
convertToPipeMethod · 0.80
setStepDescriptionMethod · 0.80
marksMethod · 0.80
readFromPartsMethod · 0.80

Tested by

no test coverage detected