mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-13 11:04:10 +00:00
optimize insertFrom of ColumnAggregateFunction to share Aggregate State in some cases
This commit is contained in:
parent
fb5de73bad
commit
d666951cb1
@ -279,7 +279,7 @@ void ColumnAggregateFunction::insertRangeFrom(const IColumn & from, size_t start
|
|||||||
|
|
||||||
size_t end = start + length;
|
size_t end = start + length;
|
||||||
for (size_t i = start; i < end; ++i)
|
for (size_t i = start; i < end; ++i)
|
||||||
insertFrom(from, i);
|
insertFromWithOwnership(from, i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -448,7 +448,7 @@ void ColumnAggregateFunction::insertData(const char * pos, size_t /*length*/)
|
|||||||
data.push_back(*reinterpret_cast<const AggregateDataPtr *>(pos));
|
data.push_back(*reinterpret_cast<const AggregateDataPtr *>(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColumnAggregateFunction::insertFrom(const IColumn & from, size_t n)
|
void ColumnAggregateFunction::insertFromWithOwnership(const IColumn & from, size_t n)
|
||||||
{
|
{
|
||||||
/// Must create new state of aggregate function and take ownership of it,
|
/// Must create new state of aggregate function and take ownership of it,
|
||||||
/// because ownership of states of aggregate function cannot be shared for individual rows,
|
/// because ownership of states of aggregate function cannot be shared for individual rows,
|
||||||
@ -458,6 +458,11 @@ void ColumnAggregateFunction::insertFrom(const IColumn & from, size_t n)
|
|||||||
insertMergeFrom(from, n);
|
insertMergeFrom(from, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ColumnAggregateFunction::insertFrom(const IColumn & from, size_t n)
|
||||||
|
{
|
||||||
|
insertRangeFrom(from, n, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void ColumnAggregateFunction::insertFrom(ConstAggregateDataPtr place)
|
void ColumnAggregateFunction::insertFrom(ConstAggregateDataPtr place)
|
||||||
{
|
{
|
||||||
ensureOwnership();
|
ensureOwnership();
|
||||||
|
@ -98,6 +98,8 @@ private:
|
|||||||
|
|
||||||
ColumnAggregateFunction(const ColumnAggregateFunction & src_);
|
ColumnAggregateFunction(const ColumnAggregateFunction & src_);
|
||||||
|
|
||||||
|
void insertFromWithOwnership(const IColumn & from, size_t n);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~ColumnAggregateFunction() override;
|
~ColumnAggregateFunction() override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user