提交 c3c5d87b 编写于 作者: S sambitesh

Fix flakey percentile test

This query was added to "percentile" in commit b877cd43 as outer references
were allowed after we backported ordered-set aggregates. But the query was
using an ARRAY sublink, which semantically does not guarantee ordering. This
causes sporadic failure in tests.

This commit tweaks the test query so that it has a deterministic ordering in
the output array.

We considered just adding an ORDER BY to the subquery, but ultimately we chose
to use `array_agg` with an `ORDER BY` because subquery order is not preserved
per SQL standard.
Signed-off-by: NSambitesh Dash <sdash@pivotal.io>
上级 09658d96
...@@ -1131,10 +1131,10 @@ select (select a from perct where median(t.a) = 5) from perct t; ...@@ -1131,10 +1131,10 @@ select (select a from perct where median(t.a) = 5) from perct t;
(1 row) (1 row)
select array((select a from perct where median(t.a) = 50.5)) from (select * from perct t order by a offset 0) as t; select (select array_agg(a ORDER BY a) from perct where median(t.a) = 50.5) from (select * from perct t order by a offset 0) as t;
?column? ?column?
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{1,2,13,14,15,16,17,28,29,30,31,33,34,35,36,37,48,49,50,51,52,63,68,69,70,71,72,83,84,85,86,3,4,5,6,7,18,19,20,21,22,38,39,40,41,42,53,54,55,56,57,73,74,75,76,77,87,88,89,90,91,96,97,8,9,10,11,12,23,24,25,26,27,32,43,44,45,46,47,58,59,60,61,62,64,65,66,67,78,79,80,81,82,92,93,94,95,98,99,100} {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100}
(1 row) (1 row)
-- MPP-22219 -- MPP-22219
......
...@@ -223,7 +223,7 @@ select percentile_cont(now()) within group (order by a) from percts; ...@@ -223,7 +223,7 @@ select percentile_cont(now()) within group (order by a) from percts;
select percentile_cont(0.5) within group (order by point(0,0)) from perct; select percentile_cont(0.5) within group (order by point(0,0)) from perct;
-- outer references -- outer references
select (select a from perct where median(t.a) = 5) from perct t; select (select a from perct where median(t.a) = 5) from perct t;
select array((select a from perct where median(t.a) = 50.5)) from (select * from perct t order by a offset 0) as t; select (select array_agg(a ORDER BY a) from perct where median(t.a) = 50.5) from (select * from perct t order by a offset 0) as t;
-- MPP-22219 -- MPP-22219
select count(*) from select count(*) from
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册