Skip to content

Commit 2b31b25

Browse files
kainwenyjhjstz
authored andcommitted
Add Cases for Issue 15794, 15767 and 15793.
1 parent 3420d9b commit 2b31b25

File tree

3 files changed

+147
-0
lines changed

3 files changed

+147
-0
lines changed

src/test/regress/expected/bfv_subquery.out

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,3 +555,57 @@ limit 15;
555555
2 | 102
556556
(15 rows)
557557

558+
-- Test case for Issue 15794, 15767 and 15793
559+
create table t_15767 (c0 int, c1 int);
560+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c0' as the Greenplum Database data distribution key for this table.
561+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
562+
insert into t_15767 values(1,0),(2,1);
563+
select max(c0) from t_15767
564+
union all
565+
select max(c0) from t_15767
566+
group by 1*t_15767.c0;
567+
max
568+
-----
569+
2
570+
1
571+
2
572+
(3 rows)
573+
574+
drop table t_15767;
575+
create table t2_15794(
576+
id integer,
577+
x double precision,
578+
y double precision,
579+
position double precision[]
580+
);
581+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Greenplum Database data distribution key for this table.
582+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
583+
insert into t2_15794 values (1,1,1,array[1,1]);
584+
insert into t2_15794 values (2,2,2,array[2,2]);
585+
select array_agg(length) from (
586+
select (
587+
array_upper( position, 1)
588+
- array_lower( position, 1) + 1
589+
) as length,
590+
array_lower( position, 1) as lower
591+
from t2_15794
592+
group by length, lower) t;
593+
array_agg
594+
-----------
595+
{2}
596+
(1 row)
597+
598+
drop table t2_15794;
599+
create table t1_15793 (c0 int);
600+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c0' as the Greenplum Database data distribution key for this table.
601+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
602+
create table t2_15793 (c0 int);
603+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c0' as the Greenplum Database data distribution key for this table.
604+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
605+
select * from t1_15793 cross join t2_15793 where not ((t1_15793.c0)+(t1_15793.c0)!=(t2_15793.c0));
606+
c0 | c0
607+
----+----
608+
(0 rows)
609+
610+
drop table t1_15793;
611+
drop table t2_15793;

src/test/regress/expected/bfv_subquery_optimizer.out

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,3 +550,57 @@ limit 15;
550550
2 | 102
551551
(15 rows)
552552

553+
-- Test case for Issue 15794, 15767 and 15793
554+
create table t_15767 (c0 int, c1 int);
555+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c0' as the Greenplum Database data distribution key for this table.
556+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
557+
insert into t_15767 values(1,0),(2,1);
558+
select max(c0) from t_15767
559+
union all
560+
select max(c0) from t_15767
561+
group by 1*t_15767.c0;
562+
max
563+
-----
564+
2
565+
2
566+
1
567+
(3 rows)
568+
569+
drop table t_15767;
570+
create table t2_15794(
571+
id integer,
572+
x double precision,
573+
y double precision,
574+
position double precision[]
575+
);
576+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Greenplum Database data distribution key for this table.
577+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
578+
insert into t2_15794 values (1,1,1,array[1,1]);
579+
insert into t2_15794 values (2,2,2,array[2,2]);
580+
select array_agg(length) from (
581+
select (
582+
array_upper( position, 1)
583+
- array_lower( position, 1) + 1
584+
) as length,
585+
array_lower( position, 1) as lower
586+
from t2_15794
587+
group by length, lower) t;
588+
array_agg
589+
-----------
590+
{2}
591+
(1 row)
592+
593+
drop table t2_15794;
594+
create table t1_15793 (c0 int);
595+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c0' as the Greenplum Database data distribution key for this table.
596+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
597+
create table t2_15793 (c0 int);
598+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c0' as the Greenplum Database data distribution key for this table.
599+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
600+
select * from t1_15793 cross join t2_15793 where not ((t1_15793.c0)+(t1_15793.c0)!=(t2_15793.c0));
601+
c0 | c0
602+
----+----
603+
(0 rows)
604+
605+
drop table t1_15793;
606+
drop table t2_15793;

src/test/regress/sql/bfv_subquery.sql

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,42 @@ select with_test2.* from with_test2
325325
where value < all (select total from my_group_sum where my_group_sum.i = with_test2.i)
326326
order by 1,2
327327
limit 15;
328+
329+
-- Test case for Issue 15794, 15767 and 15793
330+
create table t_15767 (c0 int, c1 int);
331+
insert into t_15767 values(1,0),(2,1);
332+
333+
select max(c0) from t_15767
334+
union all
335+
select max(c0) from t_15767
336+
group by 1*t_15767.c0;
337+
338+
drop table t_15767;
339+
340+
create table t2_15794(
341+
id integer,
342+
x double precision,
343+
y double precision,
344+
position double precision[]
345+
);
346+
347+
insert into t2_15794 values (1,1,1,array[1,1]);
348+
insert into t2_15794 values (2,2,2,array[2,2]);
349+
350+
select array_agg(length) from (
351+
select (
352+
array_upper( position, 1)
353+
- array_lower( position, 1) + 1
354+
) as length,
355+
array_lower( position, 1) as lower
356+
from t2_15794
357+
group by length, lower) t;
358+
359+
drop table t2_15794;
360+
361+
create table t1_15793 (c0 int);
362+
create table t2_15793 (c0 int);
363+
select * from t1_15793 cross join t2_15793 where not ((t1_15793.c0)+(t1_15793.c0)!=(t2_15793.c0));
364+
365+
drop table t1_15793;
366+
drop table t2_15793;

0 commit comments

Comments
 (0)