organize code [#METR-23881]

This commit is contained in:
artpaul 2016-12-29 16:55:10 +05:00
parent 405382b092
commit 2b38babb89
2 changed files with 23 additions and 13 deletions

View File

@ -21,6 +21,9 @@ public:
protected:
Block readImpl() override;
private:
ConstColumnPlainPtrs getKeyColumns(Block & block) const;
private:
using MapHashed = HashMap<UInt128, UInt64, UInt128TrivialHash>;

View File

@ -25,21 +25,11 @@ Block LimitByBlockInputStream::readImpl()
if (!block)
return Block();
size_t rows = block.rows();
size_t old_set_size = set.size();
const ConstColumnPlainPtrs column_ptrs(getKeyColumns(block));
const size_t rows = block.rows();
const size_t old_set_size = set.size();
IColumn::Filter filter(rows);
ConstColumnPlainPtrs column_ptrs;
column_ptrs.reserve(columns_names.size());
for (size_t i = 0; i < columns_names.size(); ++i)
{
auto & column = block.getByName(columns_names[i]).column;
if (!column->isConst())
column_ptrs.emplace_back(column.get());
}
for (size_t i = 0; i < rows; ++i)
{
UInt128 key;
@ -76,4 +66,21 @@ Block LimitByBlockInputStream::readImpl()
}
}
ConstColumnPlainPtrs LimitByBlockInputStream::getKeyColumns(Block & block) const
{
ConstColumnPlainPtrs column_ptrs;
column_ptrs.reserve(columns_names.size());
for (const auto & name : columns_names)
{
auto & column = block.getByName(name).column;
/// Ignore all constant columns.
if (!column->isConst())
column_ptrs.emplace_back(column.get());
}
return column_ptrs;
}
}