mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Set query id in case of exceptions during query execution
This commit is contained in:
parent
a04b38db90
commit
91a34fa627
@ -1273,18 +1273,24 @@ void executeQuery(
|
||||
end = begin + parse_buf.size();
|
||||
}
|
||||
|
||||
ASTPtr ast;
|
||||
BlockIO streams;
|
||||
|
||||
std::tie(ast, streams) = executeQueryImpl(begin, end, context, false, QueryProcessingStage::Complete, &istr);
|
||||
auto & pipeline = streams.pipeline;
|
||||
|
||||
QueryResultDetails result_details
|
||||
{
|
||||
.query_id = context->getClientInfo().current_query_id,
|
||||
.timezone = DateLUT::instance().getTimeZone(),
|
||||
};
|
||||
|
||||
// Set the result details in case of any exception raised during query execution
|
||||
SCOPE_EXIT({
|
||||
if (set_result_details)
|
||||
set_result_details(result_details);
|
||||
});
|
||||
|
||||
ASTPtr ast;
|
||||
BlockIO streams;
|
||||
|
||||
std::tie(ast, streams) = executeQueryImpl(begin, end, context, false, QueryProcessingStage::Complete, &istr);
|
||||
auto & pipeline = streams.pipeline;
|
||||
|
||||
std::unique_ptr<WriteBuffer> compressed_buffer;
|
||||
try
|
||||
{
|
||||
@ -1353,9 +1359,13 @@ void executeQuery(
|
||||
pipeline.setProgressCallback(context->getProgressCallback());
|
||||
}
|
||||
|
||||
if (set_result_details)
|
||||
if (set_result_details) {
|
||||
set_result_details(result_details);
|
||||
|
||||
// Clear the callback so that result details won't be set twice in case of any exception raised after this point
|
||||
set_result_details = nullptr;
|
||||
}
|
||||
|
||||
if (pipeline.initialized())
|
||||
{
|
||||
CompletedPipelineExecutor executor(pipeline);
|
||||
|
Loading…
Reference in New Issue
Block a user