mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 21:12:28 +00:00
Delete updateRowsProgressApprox implementation
This commit is contained in:
parent
cf082f2f9a
commit
f48cd0f926
@ -1,52 +0,0 @@
|
|||||||
#include <Storages/ReadFromStorageProgress.h>
|
|
||||||
#include <Processors/ISource.h>
|
|
||||||
#include <QueryPipeline/StreamLocalLimits.h>
|
|
||||||
|
|
||||||
namespace DB
|
|
||||||
{
|
|
||||||
|
|
||||||
void updateRowsProgressApprox(
|
|
||||||
ISource & source,
|
|
||||||
size_t num_rows,
|
|
||||||
UInt64 chunk_bytes_size,
|
|
||||||
UInt64 total_result_size,
|
|
||||||
UInt64 & total_rows_approx_accumulated,
|
|
||||||
size_t & total_rows_count_times,
|
|
||||||
UInt64 & total_rows_approx_max)
|
|
||||||
{
|
|
||||||
if (!total_result_size)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!num_rows)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const auto progress = source.getReadProgress();
|
|
||||||
if (progress && !progress->limits.empty())
|
|
||||||
{
|
|
||||||
for (const auto & limit : progress->limits)
|
|
||||||
{
|
|
||||||
if (limit.leaf_limits.max_rows || limit.leaf_limits.max_bytes
|
|
||||||
|| limit.local_limits.size_limits.max_rows || limit.local_limits.size_limits.max_bytes)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto bytes_per_row = std::ceil(static_cast<double>(chunk_bytes_size) / num_rows);
|
|
||||||
size_t total_rows_approx = static_cast<size_t>(std::ceil(static_cast<double>(total_result_size) / bytes_per_row));
|
|
||||||
total_rows_approx_accumulated += total_rows_approx;
|
|
||||||
++total_rows_count_times;
|
|
||||||
total_rows_approx = total_rows_approx_accumulated / total_rows_count_times;
|
|
||||||
|
|
||||||
/// We need to add diff, because total_rows_approx is incremental value.
|
|
||||||
/// It would be more correct to send total_rows_approx as is (not a diff),
|
|
||||||
/// but incrementation of total_rows_to_read does not allow that.
|
|
||||||
/// A new counter can be introduced for that to be sent to client, but it does not worth it.
|
|
||||||
if (total_rows_approx > total_rows_approx_max)
|
|
||||||
{
|
|
||||||
size_t diff = total_rows_approx - total_rows_approx_max;
|
|
||||||
source.addTotalRowsApprox(diff);
|
|
||||||
total_rows_approx_max = total_rows_approx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <Core/Types.h>
|
|
||||||
|
|
||||||
namespace DB
|
|
||||||
{
|
|
||||||
|
|
||||||
class ISource;
|
|
||||||
|
|
||||||
void updateRowsProgressApprox(
|
|
||||||
ISource & source,
|
|
||||||
size_t num_rows,
|
|
||||||
UInt64 chunk_bytes_size,
|
|
||||||
UInt64 total_result_size,
|
|
||||||
UInt64 & total_rows_approx_accumulated,
|
|
||||||
size_t & total_rows_count_times,
|
|
||||||
UInt64 & total_rows_approx_max);
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user