ClickHouse/dbms/src/Dictionaries/DictionaryBlockInputStreamBase.cpp

28 lines
623 B
C++
Raw Normal View History

2017-04-28 18:33:31 +00:00
#include <Dictionaries/DictionaryBlockInputStreamBase.h>
namespace DB
{
DictionaryBlockInputStreamBase::DictionaryBlockInputStreamBase(size_t rows_count, size_t max_block_size)
2018-08-24 05:37:06 +00:00
: rows_count(rows_count), max_block_size(max_block_size)
{
}
2017-04-28 18:33:31 +00:00
Block DictionaryBlockInputStreamBase::readImpl()
{
if (next_row == rows_count)
2017-04-28 18:33:31 +00:00
return Block();
size_t block_size = std::min<size_t>(max_block_size, rows_count - next_row);
Block block = getBlock(next_row, block_size);
next_row += block_size;
2017-04-28 18:33:31 +00:00
return block;
}
Block DictionaryBlockInputStreamBase::getHeader() const
{
return getBlock(0, 0);
}
}