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

Function executeSubPipeline

src/Interpreters/executeSubQuery.cpp:220–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void executeSubPipeline(
221 const ASTPtr & query,
222 ContextMutablePtr query_context,
223 std::function<void(InterpreterSelectQueryUseOptimizer &)> pre_execute,
224 std::function<void(Block &)> proc_block)
225{
226 if (!query->as<ASTSelectWithUnionQuery>())
227 throw Exception(
228 ErrorCodes::LOGICAL_ERROR,
229 "Unrecognized query type '{}' when executing subquery {}",
230 query->getID(),
231 query->formatForErrorMessage());
232
233 std::exception_ptr exception;
234 auto thread = ThreadFromGlobalPool([query_context = std::move(query_context), &query, pre_execute, proc_block, &exception]() {
235 try
236 {
237 CurrentThread::QueryScope query_scope{query_context};
238 {
239 SelectQueryOptions query_options;
240 InterpreterSelectQueryUseOptimizer interpreter{query, query_context, query_options};
241 auto block_io = interpreter.execute();
242 PullingPipelineExecutor executor(block_io.pipeline);
243
244 pre_execute(interpreter);
245
246 Block block;
247 while (executor.pull(block))
248 {
249 if (block.rows() == 0)
250 continue;
251 proc_block(block);
252 }
253 }
254 }
255 catch (...)
256 {
257 exception = constructException(query_context);
258 }
259 });
260 thread.join();
261
262 if (exception)
263 std::rethrow_exception(exception);
264}
265}

Callers 1

getInSubqueryResultMethod · 0.85

Calls 9

constructExceptionFunction · 0.85
formatForErrorMessageMethod · 0.80
ExceptionClass · 0.70
getIDMethod · 0.45
executeMethod · 0.45
pullMethod · 0.45
rowsMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected