mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 06:01:57 +00:00
updated MergeTreePrewhereRangeReader; renamed MergeTreePrewhereRangeReader to MergeTreeRangeReader
This commit is contained in:
parent
dcd99860fe
commit
2bf1931d86
@ -187,8 +187,10 @@ void MergeTreeRangeReader::ReadResult::addGranule(size_t num_rows)
|
|||||||
num_read_rows += num_rows;
|
num_read_rows += num_rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MergeTreeRangeReader::ReadResult::adjustLastGranule(size_t num_rows_to_subtract)
|
void MergeTreeRangeReader::ReadResult::adjustLastGranule()
|
||||||
{
|
{
|
||||||
|
size_t num_rows_to_subtract = num_read_rows - num_added_rows;
|
||||||
|
|
||||||
if (rows_per_granule.empty())
|
if (rows_per_granule.empty())
|
||||||
throw Exception("Can't adjust last granule because no granules were added.", ErrorCodes::LOGICAL_ERROR);
|
throw Exception("Can't adjust last granule because no granules were added.", ErrorCodes::LOGICAL_ERROR);
|
||||||
|
|
||||||
@ -448,17 +450,8 @@ MergeTreeRangeReader::ReadResult MergeTreeRangeReader::startReadingChain(size_t
|
|||||||
|
|
||||||
result.addRows(stream.finalize(result.block));
|
result.addRows(stream.finalize(result.block));
|
||||||
|
|
||||||
auto last_granule = result.rowsPerGranule().back();
|
|
||||||
auto added_rows = result.numAddedRows();
|
|
||||||
auto num_read_rows = result.numReadRows();
|
|
||||||
|
|
||||||
if (num_read_rows - last_granule > added_rows)
|
|
||||||
throw Exception("RangeReader expected reading of at least " + toString(num_read_rows - last_granule) +
|
|
||||||
" rows, but only " + toString(added_rows) + " was read.", ErrorCodes::LOGICAL_ERROR);
|
|
||||||
|
|
||||||
/// Last granule may be incomplete.
|
/// Last granule may be incomplete.
|
||||||
size_t adjustment = max_rows - added_rows;
|
result.adjustLastGranule();
|
||||||
result.adjustLastGranule(adjustment);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ public:
|
|||||||
const ColumnPtr & getFilter() const { return filter; }
|
const ColumnPtr & getFilter() const { return filter; }
|
||||||
|
|
||||||
void addGranule(size_t num_rows);
|
void addGranule(size_t num_rows);
|
||||||
void adjustLastGranule(size_t num_rows_to_subtract);
|
void adjustLastGranule();
|
||||||
void addRows(size_t rows) { num_added_rows += rows; }
|
void addRows(size_t rows) { num_added_rows += rows; }
|
||||||
void addRange(const MarkRange & range) { started_ranges.push_back({rows_per_granule.size(), range}); }
|
void addRange(const MarkRange & range) { started_ranges.push_back({rows_per_granule.size(), range}); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user