mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
better arguments
This commit is contained in:
parent
0dfe96fc02
commit
cd08057285
@ -93,7 +93,7 @@ ColumnPtr ColumnConst::replicate(const Offsets & offsets) const
|
||||
|
||||
ColumnPtr ColumnConst::permute(const Permutation & perm, size_t limit) const
|
||||
{
|
||||
limit = getLimitForPermutation(*this, perm, limit);
|
||||
limit = getLimitForPermutation(size(), perm.size(), limit);
|
||||
return ColumnConst::create(data, limit);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ void ColumnFunction::expand(const Filter & mask, bool inverted)
|
||||
|
||||
ColumnPtr ColumnFunction::permute(const Permutation & perm, size_t limit) const
|
||||
{
|
||||
limit = getLimitForPermutation(*this, perm, limit);
|
||||
limit = getLimitForPermutation(size(), perm.size(), limit);
|
||||
|
||||
ColumnsWithTypeAndName capture = captured_columns;
|
||||
for (auto & column : capture)
|
||||
|
@ -72,17 +72,16 @@ ColumnPtr selectIndexImpl(const Column & column, const IColumn & indexes, size_t
|
||||
ErrorCodes::LOGICAL_ERROR);
|
||||
}
|
||||
|
||||
template <typename Column>
|
||||
size_t getLimitForPermutation(const Column & column, const IColumn::Permutation & perm, size_t limit)
|
||||
size_t getLimitForPermutation(size_t column_size, size_t perm_size, size_t limit)
|
||||
{
|
||||
if (limit == 0)
|
||||
limit = column.size();
|
||||
limit = column_size;
|
||||
else
|
||||
limit = std::min(column.size(), limit);
|
||||
limit = std::min(column_size, limit);
|
||||
|
||||
if (perm.size() < limit)
|
||||
if (perm_size < limit)
|
||||
throw Exception(ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH,
|
||||
"Size of permutation ({}) is less than required ({})", perm.size(), limit);
|
||||
"Size of permutation ({}) is less than required ({})", perm_size, limit);
|
||||
|
||||
return limit;
|
||||
}
|
||||
@ -90,7 +89,7 @@ size_t getLimitForPermutation(const Column & column, const IColumn::Permutation
|
||||
template <typename Column>
|
||||
ColumnPtr permuteImpl(const Column & column, const IColumn::Permutation & perm, size_t limit)
|
||||
{
|
||||
limit = getLimitForPermutation(column, perm, limit);
|
||||
limit = getLimitForPermutation(column.size(), perm.size(), limit);
|
||||
return column.indexImpl(perm, limit);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user