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

Method getSelectResult

src/Interpreters/InterpreterKillQueryQuery.cpp:429–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427}
428
429Block InterpreterKillQueryQuery::getSelectResult(const String & columns, const String & table)
430{
431 String select_query = "SELECT " + columns + " FROM " + table;
432 auto & where_expression = query_ptr->as<ASTKillQueryQuery>()->where_expression;
433 if (where_expression)
434 select_query += " WHERE " + where_expression->formatWithSecretsOneLine();
435
436 auto query_context = Context::createCopy(getContext());
437 query_context->makeQueryContext();
438 query_context->setCurrentQueryId("");
439
440 auto io = executeQuery(select_query, std::move(query_context), QueryFlags{ .internal = true }).second;
441
442 Block res;
443 Block tmp_block;
444 io.executeWithCallbacks([&]()
445 {
446 PullingPipelineExecutor executor(io.pipeline);
447 while (res.empty() && executor.pull(res));
448
449 while (executor.pull(tmp_block));
450 });
451
452 if (!tmp_block.empty())
453 throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected one block from input stream");
454
455 /// Materialize const columns, because callers use typeid_cast to concrete column types.
456 materializeBlockInplace(res);
457
458 return res;
459}
460
461
462AccessRightsElements InterpreterKillQueryQuery::getRequiredAccessForDDLOnCluster() const

Callers

nothing calls this directly

Calls 10

materializeBlockInplaceFunction · 0.85
setCurrentQueryIdMethod · 0.80
executeWithCallbacksMethod · 0.80
executeQueryFunction · 0.70
ExceptionClass · 0.70
getContextFunction · 0.50
makeQueryContextMethod · 0.45
emptyMethod · 0.45
pullMethod · 0.45

Tested by

no test coverage detected