You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2 - Execute one of these queries, which give incorrect results:
SELECT dep, name, salary, CUME_DIST() OVER (partition by dep ORDER BY salary) cume_dist_val FROM employees;
SELECT dep, name, salary, CUME_DIST() OVER (PARTITION BY dep) cume_dist_val FROM employees;
The expected results would be values between 0 and 1, with each row's value being the number of rows with values lower or equal divided by the total number of rows in the window or partition.
The actual results go above 1 and are incorrect.
Date: 2020-02-20 15:48:36 +0100
From: @bernardom29
To: SQL devs <>
Version: 11.35.9 (Nov2019-SP1)
CC: @PedroTadim
Last updated: 2020-02-24 09:32:58 +0100
Comment 27570
Date: 2020-02-20 15:48:36 +0100
From: @bernardom29
The CUME_DIST() window function is returning incorrect results, even returning values above 1 (the return values should always be within 0 and 1).
Overview of CUME_DIST function: https://www.sqlitetutorial.net/sqlite-window-functions/sqlite-cume_dist/
How to reproduce:
1 - Create test table and add some values
create table employees (dep varchar(10), name varchar(20), salary double);
insert into employees values
('mgmt', 'Smith',81),
('dev', 'Jones',55),
('sls', 'Williams',55),
('sls', 'Taylor',62),
('dev', 'Brown',62),
('mgmt', 'Davies',84),
('sls', 'Evans',87),
('sls', 'Wilson',72),
('sls', 'Thomas',72),
('mgmt', 'Johnson',100);
2 - Execute one of these queries, which give incorrect results:
SELECT dep, name, salary, CUME_DIST() OVER (partition by dep ORDER BY salary) cume_dist_val FROM employees;
SELECT dep, name, salary, CUME_DIST() OVER (PARTITION BY dep) cume_dist_val FROM employees;
The expected results would be values between 0 and 1, with each row's value being the number of rows with values lower or equal divided by the total number of rows in the window or partition.
The actual results go above 1 and are incorrect.
Comment 27571
Date: 2020-02-20 16:11:11 +0100
From: MonetDB Mercurial Repository <>
Changeset 176ea6bea667 made by Pedro Ferreira pedro.ferreira@monetdbsolutions.com in the MonetDB repo, refers to this bug.
For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=176ea6bea667
Changeset description:
The text was updated successfully, but these errors were encountered: