Skip to content

Commit 27e1e38

Browse files
committed
Updated status of PG regression tests
1 parent 07fde13 commit 27e1e38

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+19479
-3967
lines changed

ydb/library/yql/tests/postgresql/cases/aggregates.err

Lines changed: 2200 additions & 1 deletion
Large diffs are not rendered by default.

ydb/library/yql/tests/postgresql/cases/aggregates.out

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,6 @@ SELECT covar_pop(1::float8,'nan'::float8), covar_samp(3::float8,'nan'::float8);
270270
-- test accum and combine functions directly
271271
CREATE TABLE regr_test (x float8, y float8);
272272
INSERT INTO regr_test VALUES (10,150),(20,250),(30,350),(80,540),(100,200);
273-
SELECT count(*), sum(x), regr_sxx(y,x), sum(y),regr_syy(y,x), regr_sxy(y,x)
274-
FROM regr_test;
275-
count | sum | regr_sxx | sum | regr_syy | regr_sxy
276-
-------+-----+----------+------+----------+----------
277-
5 | 240 | 6280 | 1490 | 95080 | 8680
278-
(1 row)
279-
280273
SELECT float8_accum('{4,140,2900}'::float8[], 100);
281274
float8_accum
282275
--------------
@@ -363,3 +356,88 @@ insert into minmaxtest values(11), (12);
363356
create temp table t1 (a int, b int, c int, d int, primary key (a, b));
364357
create temp table t2 (x int, y int, z int, primary key (x, y));
365358
drop table t2;
359+
--
360+
-- Test GROUP BY matching of join columns that are type-coerced due to USING
361+
--
362+
create temp table t1(f1 int, f2 bigint);
363+
create temp table t2(f1 bigint, f22 bigint);
364+
drop table t1, t2;
365+
-- string_agg tests
366+
select string_agg(a,',') from (values('aaaa'),('bbbb'),('cccc')) g(a);
367+
string_agg
368+
----------------
369+
aaaa,bbbb,cccc
370+
(1 row)
371+
372+
select string_agg(a,',') from (values('aaaa'),(null),('bbbb'),('cccc')) g(a);
373+
string_agg
374+
----------------
375+
aaaa,bbbb,cccc
376+
(1 row)
377+
378+
select string_agg(a,'AB') from (values(null),(null),('bbbb'),('cccc')) g(a);
379+
string_agg
380+
------------
381+
bbbbABcccc
382+
(1 row)
383+
384+
select string_agg(a,',') from (values(null),(null)) g(a);
385+
string_agg
386+
------------
387+
388+
(1 row)
389+
390+
-- string_agg bytea tests
391+
create table bytea_test_table(v bytea);
392+
select string_agg(v, '') from bytea_test_table;
393+
string_agg
394+
------------
395+
396+
(1 row)
397+
398+
insert into bytea_test_table values(decode('ff','hex'));
399+
select string_agg(v, '') from bytea_test_table;
400+
string_agg
401+
------------
402+
\xff
403+
(1 row)
404+
405+
insert into bytea_test_table values(decode('aa','hex'));
406+
select string_agg(v, '') from bytea_test_table;
407+
string_agg
408+
------------
409+
\xffaa
410+
(1 row)
411+
412+
select string_agg(v, NULL) from bytea_test_table;
413+
string_agg
414+
------------
415+
\xffaa
416+
(1 row)
417+
418+
select string_agg(v, decode('ee', 'hex')) from bytea_test_table;
419+
string_agg
420+
------------
421+
\xffeeaa
422+
(1 row)
423+
424+
drop table bytea_test_table;
425+
-- outer reference in FILTER (PostgreSQL extension)
426+
select (select count(*)
427+
from (values (1)) t0(inner_c))
428+
from (values (2),(3)) t1(outer_c); -- inner query is aggregation query
429+
count
430+
-------
431+
1
432+
1
433+
(2 rows)
434+
435+
select p, percentile_cont(p order by p) within group (order by x) -- error
436+
from generate_series(1,5) x,
437+
(values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p)
438+
group by p order by p;
439+
ERROR: cannot use multiple ORDER BY clauses with WITHIN GROUP
440+
LINE 1: select p, percentile_cont(p order by p) within group (order ...
441+
^
442+
-- test aggregates with common transition functions share the same states
443+
begin work;

ydb/library/yql/tests/postgresql/cases/aggregates.sql

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ SELECT covar_pop(1::float8,'nan'::float8), covar_samp(3::float8,'nan'::float8);
6565
-- test accum and combine functions directly
6666
CREATE TABLE regr_test (x float8, y float8);
6767
INSERT INTO regr_test VALUES (10,150),(20,250),(30,350),(80,540),(100,200);
68-
SELECT count(*), sum(x), regr_sxx(y,x), sum(y),regr_syy(y,x), regr_sxy(y,x)
69-
FROM regr_test;
7068
SELECT float8_accum('{4,140,2900}'::float8[], 100);
7169
SELECT float8_regr_accum('{4,140,2900,1290,83075,15050}'::float8[], 200, 100);
7270
SELECT float8_combine('{3,60,200}'::float8[], '{0,0,0}'::float8[]);
@@ -113,3 +111,34 @@ insert into minmaxtest values(11), (12);
113111
create temp table t1 (a int, b int, c int, d int, primary key (a, b));
114112
create temp table t2 (x int, y int, z int, primary key (x, y));
115113
drop table t2;
114+
--
115+
-- Test GROUP BY matching of join columns that are type-coerced due to USING
116+
--
117+
create temp table t1(f1 int, f2 bigint);
118+
create temp table t2(f1 bigint, f22 bigint);
119+
drop table t1, t2;
120+
-- string_agg tests
121+
select string_agg(a,',') from (values('aaaa'),('bbbb'),('cccc')) g(a);
122+
select string_agg(a,',') from (values('aaaa'),(null),('bbbb'),('cccc')) g(a);
123+
select string_agg(a,'AB') from (values(null),(null),('bbbb'),('cccc')) g(a);
124+
select string_agg(a,',') from (values(null),(null)) g(a);
125+
-- string_agg bytea tests
126+
create table bytea_test_table(v bytea);
127+
select string_agg(v, '') from bytea_test_table;
128+
insert into bytea_test_table values(decode('ff','hex'));
129+
select string_agg(v, '') from bytea_test_table;
130+
insert into bytea_test_table values(decode('aa','hex'));
131+
select string_agg(v, '') from bytea_test_table;
132+
select string_agg(v, NULL) from bytea_test_table;
133+
select string_agg(v, decode('ee', 'hex')) from bytea_test_table;
134+
drop table bytea_test_table;
135+
-- outer reference in FILTER (PostgreSQL extension)
136+
select (select count(*)
137+
from (values (1)) t0(inner_c))
138+
from (values (2),(3)) t1(outer_c); -- inner query is aggregation query
139+
select p, percentile_cont(p order by p) within group (order by x) -- error
140+
from generate_series(1,5) x,
141+
(values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p)
142+
group by p order by p;
143+
-- test aggregates with common transition functions share the same states
144+
begin work;

0 commit comments

Comments
 (0)