This commit is contained in:
Nikita Mikhaylov 2021-04-09 00:22:18 +03:00
parent 3426bc3906
commit 86933749bd
5 changed files with 39 additions and 3 deletions

View File

@ -174,6 +174,8 @@ public:
return "mannWhitneyUTest"; return "mannWhitneyUTest";
} }
bool allocatesMemoryInArena() const override { return true; }
DataTypePtr getReturnType() const override DataTypePtr getReturnType() const override
{ {
DataTypes types DataTypes types
@ -208,7 +210,7 @@ public:
void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs, Arena * arena) const override void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs, Arena * arena) const override
{ {
auto & a = this->data(place); auto & a = this->data(place);
auto & b = this->data(rhs); const auto & b = this->data(rhs);
a.merge(b, arena); a.merge(b, arena);
} }

View File

@ -58,6 +58,8 @@ public:
return "rankCorr"; return "rankCorr";
} }
bool allocatesMemoryInArena() const override { return true; }
DataTypePtr getReturnType() const override DataTypePtr getReturnType() const override
{ {
return std::make_shared<DataTypeNumber<Float64>>(); return std::make_shared<DataTypeNumber<Float64>>();

View File

@ -128,7 +128,7 @@ private:
template <size_t> friend class AlignedArenaAllocator; template <size_t> friend class AlignedArenaAllocator;
public: public:
Arena(size_t initial_size_ = 4096, size_t growth_factor_ = 2, size_t linear_growth_threshold_ = 128 * 1024 * 1024) explicit Arena(size_t initial_size_ = 4096, size_t growth_factor_ = 2, size_t linear_growth_threshold_ = 128 * 1024 * 1024)
: growth_factor(growth_factor_), linear_growth_threshold(linear_growth_threshold_), : growth_factor(growth_factor_), linear_growth_threshold(linear_growth_threshold_),
head(new MemoryChunk(initial_size_, nullptr)), size_in_bytes(head->size()), head(new MemoryChunk(initial_size_, nullptr)), size_in_bytes(head->size()),
page_size(static_cast<size_t>(::getPageSize())) page_size(static_cast<size_t>(::getPageSize()))
@ -160,7 +160,7 @@ public:
void * head_pos = head->pos; void * head_pos = head->pos;
size_t space = head->end - head->pos; size_t space = head->end - head->pos;
auto res = static_cast<char *>(std::align(alignment, size, head_pos, space)); auto * res = static_cast<char *>(std::align(alignment, size, head_pos, space));
if (res) if (res)
{ {
head->pos = static_cast<char *>(head_pos); head->pos = static_cast<char *>(head_pos);

View File

@ -0,0 +1,10 @@
0.5060606060606061
0.5083333333333333
0.5119047619047619
0.5178571428571428
0.5285714285714286
0.525
0.55
0.625
0.5
nan

View File

@ -0,0 +1,22 @@
DROP TABLE IF EXISTS 01802_empsalary;
SET allow_experimental_window_functions=1;
CREATE TABLE 01802_empsalary
(
`depname` LowCardinality(String),
`empno` UInt64,
`salary` Int32,
`enroll_date` Date
)
ENGINE = MergeTree
ORDER BY enroll_date
SETTINGS index_granularity = 8192;
INSERT INTO 01802_empsalary VALUES ('sales', 1, 5000, '2006-10-01'), ('develop', 8, 6000, '2006-10-01'), ('personnel', 2, 3900, '2006-12-23'), ('develop', 10, 5200, '2007-08-01'), ('sales', 3, 4800, '2007-08-01'), ('sales', 4, 4800, '2007-08-08'), ('develop', 11, 5200, '2007-08-15'), ('personnel', 5, 3500, '2007-12-10'), ('develop', 7, 4200, '2008-01-01'), ('develop', 9, 4500, '2008-01-01');
SELECT mannWhitneyUTest(salary, salary) OVER (ORDER BY salary ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS func FROM 01802_empsalary; -- {serverError 36}
SELECT rankCorr(salary, 0.5) OVER (ORDER BY salary ASC ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS func FROM 01802_empsalary;
DROP TABLE IF EXISTS 01802_empsalary;