add perf test for distinct combinator

This commit is contained in:
Anton Popov 2020-06-22 16:29:11 +03:00
parent 7a76abeb2a
commit 3f0f0ff5ad
3 changed files with 7 additions and 13 deletions

View File

@ -10,7 +10,6 @@ namespace DB
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
}
class AggregateFunctionCombinatorDistinct final : public IAggregateFunctionCombinator

View File

@ -15,11 +15,6 @@
namespace DB
{
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
}
template <typename T>
struct AggregateFunctionDistinctSingleNumericData
@ -177,11 +172,7 @@ public:
AggregateFunctionDistinct(AggregateFunctionPtr nested_func_, const DataTypes & arguments)
: IAggregateFunctionDataHelper<Data, AggregateFunctionDistinct>(arguments, nested_func_->getParameters())
, nested_func(nested_func_)
, arguments_num(arguments.size())
{
if (arguments.empty())
throw Exception("Aggregate function " + getName() + " require at least one argument", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
}
, arguments_num(arguments.size()) {}
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena * arena) const override
{
@ -211,8 +202,8 @@ public:
arguments_raw[i] = arguments[i].get();
assert(!arguments.empty());
this->nested_func->addBatchSinglePlace(arguments[0]->size(), this->getNestedPlace(place), arguments_raw.data(), arena);
this->nested_func->insertResultInto(this->getNestedPlace(place), to, arena);
nested_func->addBatchSinglePlace(arguments[0]->size(), getNestedPlace(place), arguments_raw.data(), arena);
nested_func->insertResultInto(getNestedPlace(place), to, arena);
}
size_t sizeOfData() const override

View File

@ -0,0 +1,4 @@
<test>
<query>SELECT x, sum(DISTINCT y) from (SELECT number % 12 AS x, number % 12321 AS y FROM numbers(10000000)) GROUP BY x</query>
<query>SELECT x, sum(y) from (SELECT DISTINCT number % 12 AS x, number % 12321 AS y FROM numbers(10000000)) GROUP BY x</query>
</test>