fixed progress stats

This commit is contained in:
Nikolai Kochetov 2018-02-20 17:26:22 +03:00
parent 36fe36d003
commit ba81835e58
3 changed files with 14 additions and 4 deletions

View File

@ -146,13 +146,13 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
if (read_result.block.rows() == 0)
read_result.block.clear();
progressImpl({ read_result.block.rows(), read_result.block.bytes() });
size_t rows_read = read_result.numAddedRows() + read_result.numFilteredRows();
progressImpl({ rows_read, read_result.numBytesRead() });
if (task->size_predictor)
{
task->size_predictor->updateFilteredRowsRation(
read_result.numAddedRows() + read_result.numFilteredRows(),
read_result.numFilteredRows());
task->size_predictor->updateFilteredRowsRation(rows_read, read_result.numFilteredRows());
if (read_result.block)
task->size_predictor->update(read_result.block);

View File

@ -405,10 +405,12 @@ MergeTreeRangeReader::ReadResult MergeTreeRangeReader::read(size_t max_rows, Mar
throw Exception("Expected at least 1 row to read, got 0.", ErrorCodes::LOGICAL_ERROR);
ReadResult read_result;
size_t prev_bytes = 0;
if (prev_reader)
{
read_result = prev_reader->read(max_rows, ranges);
prev_bytes = read_result.block.bytes();
continueReadingChain(read_result);
}
else
@ -417,6 +419,8 @@ MergeTreeRangeReader::ReadResult MergeTreeRangeReader::read(size_t max_rows, Mar
if (!read_result.block)
return read_result;
read_result.addNumBytesRead(read_result.block.bytes() - prev_bytes);
executePrewhereActionsAndFilterColumns(read_result);
return read_result;
}

View File

@ -110,6 +110,8 @@ public:
size_t numAddedRows() const { return num_added_rows; }
/// The number of filtered rows at all steps in reading chain.
size_t numFilteredRows() const { return num_filtered_rows; }
/// The number of bytes read from disk.
size_t numBytesRead() const { return num_bytes_read; }
/// Filter you need to apply to newly-read columns in order to add them to block.
const ColumnPtr & getFilter() const { return filter; }
@ -125,6 +127,8 @@ public:
/// Remove all rows from granules.
void clear();
void addNumBytesRead(size_t count) { num_bytes_read += count; }
Block block;
private:
@ -139,6 +143,8 @@ public:
size_t num_filtered_rows = 0;
/// Zero if filter is nullptr.
size_t num_zeros_in_filter = 0;
/// Without any filtration.
size_t num_bytes_read = 0;
/// nullptr if prev reader hasn't prewhere_actions. Otherwise filter.size() >= total_rows_read.
ColumnPtr filter;