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

Function flushQueryProgress

src/Interpreters/executeQuery.cpp:574–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572}
573
574static ResultProgress flushQueryProgress(const QueryPipeline & pipeline, bool pulling_pipeline, const ProgressCallback & progress_callback, QueryStatusPtr process_list_elem)
575{
576 ResultProgress res(0, 0, 0);
577
578 if (pulling_pipeline)
579 {
580 pipeline.tryGetResultRowsAndBytes(res.result_rows, res.result_bytes);
581 }
582 else if (process_list_elem) /// will be used only for ordinary INSERT queries
583 {
584 auto progress_out = process_list_elem->getProgressOut();
585 res.result_rows = progress_out.written_rows;
586 res.result_bytes = progress_out.written_bytes;
587 }
588
589 /// Report same memory_usage in X-ClickHouse-Summary as in query_log
590 if (process_list_elem)
591 res.memory_usage = std::max<Int64>(process_list_elem->getInfo().peak_memory_usage, 0);
592
593 if (progress_callback)
594 {
595 Progress p;
596 p.incrementPiecewiseAtomically(Progress{res});
597 progress_callback(p);
598 }
599
600 return res;
601}
602
603static QueryPipelineFinalizedInfo finalizeQueryPipelineBeforeLogging(QueryPipeline && query_pipeline, QueryResultCacheUsage /*query_result_cache_usage*/, bool pulling_pipeline)
604{

Callers 1

executeQueryFunction · 0.85

Calls 4

getProgressOutMethod · 0.80
getInfoMethod · 0.45

Tested by

no test coverage detected