Per granula reading for ColumnWithDictionary in MergeTreeRangeReader.

This commit is contained in:
Nikolai Kochetov 2018-05-21 17:15:55 +03:00
parent caa86bc59a
commit d018f3ad60
2 changed files with 13 additions and 2 deletions

View File

@ -42,7 +42,7 @@ MergeTreeReader::MergeTreeReader(const String & path,
clockid_t clock_type) clockid_t clock_type)
: avg_value_size_hints(avg_value_size_hints), path(path), data_part(data_part), columns(columns) : avg_value_size_hints(avg_value_size_hints), path(path), data_part(data_part), columns(columns)
, uncompressed_cache(uncompressed_cache), mark_cache(mark_cache), save_marks_in_cache(save_marks_in_cache), storage(storage) , uncompressed_cache(uncompressed_cache), mark_cache(mark_cache), save_marks_in_cache(save_marks_in_cache), storage(storage)
, all_mark_ranges(all_mark_ranges), aio_threshold(aio_threshold), max_read_buffer_size(max_read_buffer_size) , all_mark_ranges(all_mark_ranges), aio_threshold(aio_threshold), max_read_buffer_size(max_read_buffer_size), index_granularity(storage.index_granularity)
{ {
try try
{ {
@ -383,6 +383,16 @@ void MergeTreeReader::readData(
}; };
double & avg_value_size_hint = avg_value_size_hints[name]; double & avg_value_size_hint = avg_value_size_hints[name];
if (column.withDictionary())
{
for (size_t read_rows = 0; read_rows < max_rows_to_read; read_rows += index_granularity)
{
size_t rows_to_read = std::min(index_granularity, max_rows_to_read - read_rows);
type.deserializeBinaryBulkWithMultipleStreams(column, stream_getter, rows_to_read, avg_value_size_hint, true, {});
continue_reading = true;
}
}
else
type.deserializeBinaryBulkWithMultipleStreams(column, stream_getter, max_rows_to_read, avg_value_size_hint, true, {}); type.deserializeBinaryBulkWithMultipleStreams(column, stream_getter, max_rows_to_read, avg_value_size_hint, true, {});
IDataType::updateAvgValueSizeHint(column, avg_value_size_hint); IDataType::updateAvgValueSizeHint(column, avg_value_size_hint);
} }

View File

@ -107,6 +107,7 @@ private:
MarkRanges all_mark_ranges; MarkRanges all_mark_ranges;
size_t aio_threshold; size_t aio_threshold;
size_t max_read_buffer_size; size_t max_read_buffer_size;
size_t index_granularity;
void addStreams(const String & name, const IDataType & type, const MarkRanges & all_mark_ranges, void addStreams(const String & name, const IDataType & type, const MarkRanges & all_mark_ranges,
const ReadBufferFromFileBase::ProfileCallback & profile_callback, clockid_t clock_type); const ReadBufferFromFileBase::ProfileCallback & profile_callback, clockid_t clock_type);