fix align of data && add test

This commit is contained in:
Sofia Antipushina 2020-05-25 17:02:55 +03:00
parent 7135b8491c
commit f206d74b63
3 changed files with 4 additions and 5 deletions

View File

@ -30,10 +30,7 @@ struct AggregateFunctionDistinctData
bool ALWAYS_INLINE tryToInsert(const Key& key)
{
std::lock_guard lock(mutex);
bool a = set.insert(key).second;
if (a) std::cerr << key.high << ' ' << key.low << ' ' << a << std::endl;
return a;
return set.insert(key).second;
}
};
@ -63,7 +60,7 @@ public:
: IAggregateFunctionDataHelper<AggregateFunctionDistinctData, AggregateFunctionDistinct>(arguments, {})
, nested_func(nested), num_arguments(arguments.size())
{
prefix_size = 640'000'000;
prefix_size = sizeof(AggregateFunctionDistinctData);
if (arguments.empty())
throw Exception("Aggregate function " + getName() + " require at least one argument", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);

View File

@ -1,4 +1,5 @@
499500
78
[0,1,2,3,4,5,6,7,8,9,10,11,12]
[0,1,2,3,4,5,6,7,8,9,10,11,12]
5.669227916063075e-17

View File

@ -1,4 +1,5 @@
SELECT sum(DISTINCT x) FROM (SELECT number AS x FROM system.numbers LIMIT 1000);
SELECT sum(DISTINCT x) FROM (SELECT number % 13 AS x FROM system.numbers LIMIT 1000);
SELECT groupArray(DISTINCT x) FROM (SELECT number % 13 AS x FROM system.numbers LIMIT 1000);
SELECT groupArray(DISTINCT x) FROM (SELECT number % 13 AS x FROM system.numbers_mt LIMIT 1000);
SELECT corrStableDistinct(DISTINCT x, y) FROM (SELECT number % 11 AS x, number % 13 AS y FROM system.numbers LIMIT 1000);