提交 0d42b6ef 编写于 作者: H Heikki Linnakangas

Clean up some regression tests.

* Avoid using start/end_ignore blocks where not necessary.
* Remove unnecessary DROP commands.
* Use begin/commit when building test tables, to reduce 2PC overhead
* Reuse test tables, rather than drop and recreate them

Shaves a few seconds from the total execution time.
上级 0bcc6fd6
......@@ -276,21 +276,10 @@ SELECT * FROM TIMESTAMP_MONTH_listp WHERE f2 = TO_DATE('2000-01-03', 'YYYY-MM-DD
1 | Mon Jan 03 00:00:00 2000
(1 row)
-- CLEANUP
-- start_ignore
DROP TABLE TIMESTAMP_MONTH_listp;
DROP TABLE TIMESTAMP_MONTH_rangep_STARTEXCL;
DROP TABLE TIMESTAMP_MONTH_rangep_STARTINCL;
-- end_ignore
--
-- Data Engineer can see partition key in psql
--
-- SETUP
-- start_ignore
DROP TABLE IF EXISTS T26002_T1;
NOTICE: table "t26002_t1" does not exist, skipping
DROP TABLE IF EXISTS T26002_T2;
NOTICE: table "t26002_t2" does not exist, skipping
CREATE TABLE T26002_T1 (empid int, departmentid int, year int, region varchar(20))
DISTRIBUTED BY (empid)
PARTITION BY RANGE (year)
......@@ -312,7 +301,6 @@ NOTICE: CREATE TABLE will create partition "t26002_t1_1_prt_2_2_prt_usa" for ta
NOTICE: CREATE TABLE will create partition "t26002_t1_1_prt_2_2_prt_europe" for table "t26002_t1_1_prt_2"
NOTICE: CREATE TABLE will create partition "t26002_t1_1_prt_2_2_prt_asia" for table "t26002_t1_1_prt_2"
NOTICE: CREATE TABLE will create partition "t26002_t1_1_prt_2_2_prt_other_regions" for table "t26002_t1_1_prt_2"
-- end_ignore
-- TEST
-- expected to see the partition key
\d T26002_T1;
......@@ -429,21 +417,11 @@ Distributed by: (empid)
region | character varying(20) | | extended | |
Distributed by: (empid)
-- CLEANUP
-- start_ignore
DROP TABLE IF EXISTS T26002_T1;
DROP TABLE IF EXISTS T26002_T2;
-- end_ignore
--
-- Testing whether test gives wrong results with partition tables when sub-partitions are distributed differently than the parent partition.
-- Test whether test gives wrong results with partition tables when
-- sub-partitions are distributed differently than the parent partition.
--
-- SETUP
-- start_ignore
drop table if exists pt;
NOTICE: table "pt" does not exist, skipping
drop table if exists t;
NOTICE: table "t" does not exist, skipping
-- end_ignore
create table pt(a int, b int, c int) distributed by (a) partition by range(b) (start(0) end(10) every (2));
NOTICE: CREATE TABLE will create partition "pt_1_prt_1" for table "pt"
NOTICE: CREATE TABLE will create partition "pt_1_prt_2" for table "pt"
......@@ -509,19 +487,10 @@ select a, count(*) from pt where a<2 group by a;
0 | 2
(2 rows)
-- CLEANUP
drop index pt_c;
drop table if exists pt;
drop table if exists t;
--
-- Partition table with appendonly leaf, full join
--
-- SETUP
-- start_ignore
DROP TABLE IF EXISTS foo;
NOTICE: table "foo" does not exist, skipping
DROP TABLE IF EXISTS bar;
NOTICE: table "bar" does not exist, skipping
CREATE TABLE foo (a int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -544,7 +513,6 @@ NOTICE: CREATE TABLE will create partition "bar_1_prt_1_2_prt_2" for table "bar
NOTICE: CREATE TABLE will create partition "bar_1_prt_2" for table "bar"
NOTICE: CREATE TABLE will create partition "bar_1_prt_2_2_prt_1" for table "bar_1_prt_2"
NOTICE: CREATE TABLE will create partition "bar_1_prt_2_2_prt_2" for table "bar_1_prt_2"
-- end_ignore
INSERT INTO foo VALUES (1);
INSERT INTO bar VALUES (2,3);
SELECT * FROM foo FULL JOIN bar ON foo.a = bar.b;
......@@ -555,19 +523,11 @@ SELECT * FROM foo FULL JOIN bar ON foo.a = bar.b;
(2 rows)
-- CLEANUP
-- start_ignore
DROP TABLE IF EXISTS foo;
DROP TABLE IF EXISTS bar;
-- end_ignore
DROP TABLE IF EXISTS foo, bar;
--
-- Partition table with appendonly set at middlevel partition, full join
--
-- SETUP
-- start_ignore
DROP TABLE IF EXISTS foo;
NOTICE: table "foo" does not exist, skipping
DROP TABLE IF EXISTS bar;
NOTICE: table "bar" does not exist, skipping
CREATE TABLE foo (a int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -590,7 +550,6 @@ NOTICE: CREATE TABLE will create partition "bar_1_prt_1_2_prt_2" for table "bar
NOTICE: CREATE TABLE will create partition "bar_1_prt_2" for table "bar"
NOTICE: CREATE TABLE will create partition "bar_1_prt_2_2_prt_1" for table "bar_1_prt_2"
NOTICE: CREATE TABLE will create partition "bar_1_prt_2_2_prt_2" for table "bar_1_prt_2"
-- end_ignore
INSERT INTO foo VALUES (1);
INSERT INTO bar VALUES (2,3);
SELECT * FROM foo FULL JOIN bar ON foo.a = bar.b;
......@@ -601,19 +560,11 @@ SELECT * FROM foo FULL JOIN bar ON foo.a = bar.b;
(2 rows)
-- CLEANUP
-- start_ignore
DROP TABLE IF EXISTS foo;
DROP TABLE IF EXISTS bar;
-- end_ignore
DROP TABLE IF EXISTS foo, bar;
--
-- Partition table with appendonly set at root partition, full join
--
-- SETUP
-- start_ignore
DROP TABLE IF EXISTS foo;
NOTICE: table "foo" does not exist, skipping
DROP TABLE IF EXISTS bar;
NOTICE: table "bar" does not exist, skipping
CREATE TABLE foo (a int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -636,7 +587,6 @@ NOTICE: CREATE TABLE will create partition "bar_1_prt_1_2_prt_2" for table "bar
NOTICE: CREATE TABLE will create partition "bar_1_prt_2" for table "bar"
NOTICE: CREATE TABLE will create partition "bar_1_prt_2_2_prt_1" for table "bar_1_prt_2"
NOTICE: CREATE TABLE will create partition "bar_1_prt_2_2_prt_2" for table "bar_1_prt_2"
-- end_ignore
INSERT INTO foo VALUES (1);
INSERT INTO bar VALUES (2,3);
SELECT * FROM foo FULL JOIN bar ON foo.a = bar.b;
......@@ -5211,12 +5161,8 @@ select c1, dt, count(*) from mpp6724 group by 1,2 having count(*) > 1;
drop table mpp6724;
-- Test for partition cleanup
-- start_ignore
drop schema partition_999 cascade;
ERROR: schema "partition_999" does not exist
create schema partition_999;
set search_path=bfv_partition,partition_999;
-- end_ignore
create table partition_cleanup1 (a int, b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int)
partition by range (a)
( partition aa start (1) end (10) every (1) );
......
-- start_ignore
create schema qp_subquery;
set search_path to qp_subquery;
CREATE TABLE SUBSELECT_TBL1 (
f1 integer,
f2 integer,
f3 float
);
begin;
CREATE TABLE SUBSELECT_TBL1 (f1 integer, f2 integer, f3 float);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
INSERT INTO SUBSELECT_TBL1 VALUES (1, 2, 3);
INSERT INTO SUBSELECT_TBL1 VALUES (2, 3, 4);
INSERT INTO SUBSELECT_TBL1 VALUES (3, 4, 5);
......@@ -16,8 +11,8 @@ INSERT INTO SUBSELECT_TBL1 VALUES (1, 1, 1);
INSERT INTO SUBSELECT_TBL1 VALUES (2, 2, 2);
INSERT INTO SUBSELECT_TBL1 VALUES (3, 3, 3);
INSERT INTO SUBSELECT_TBL1 VALUES (6, 7, 8);
INSERT INTO SUBSELECT_TBL1 VALUES (8, 9, NULL);
-- end_ignore
INSERT INTO SUBSELECT_TBL1 VALUES (8, 9, NULL);
commit;
SELECT '' AS eight, * FROM SUBSELECT_TBL1 ORDER BY 2,3,4;
eight | f1 | f2 | f3
-------+----+----+----
......@@ -115,7 +110,6 @@ SELECT '' AS six, f1 AS "Correlated Field", f2 AS "Second Field"
| 2 | 2
(6 rows)
SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field"
FROM SUBSELECT_TBL1 upper
WHERE f1 IN
......@@ -129,7 +123,6 @@ SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field"
| 2 | 2
(5 rows)
SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field"
FROM SUBSELECT_TBL1 upper
WHERE f3 IN (SELECT upper.f1 + f2 FROM SUBSELECT_TBL1
......@@ -142,7 +135,6 @@ SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field"
| 6 | 8
(4 rows)
SELECT '' AS five, f1 AS "Correlated Field"
FROM SUBSELECT_TBL1
WHERE (f1, f2) IN (SELECT f2, CAST(f3 AS int4) FROM SUBSELECT_TBL1
......@@ -156,8 +148,7 @@ SELECT '' AS five, f1 AS "Correlated Field"
| 2
(5 rows)
-- start_ignore
begin;
create table join_tab1 ( i integer, j integer, t text);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -172,25 +163,6 @@ INSERT INTO join_tab1 VALUES (8, 8, 'eight');
INSERT INTO join_tab1 VALUES (0, NULL, 'zero');
INSERT INTO join_tab1 VALUES (NULL, NULL, 'null');
INSERT INTO join_tab1 VALUES (NULL, 0, 'zero');
-- end_ignore
select * from join_tab1 order by i, t;
i | j | t
---+---+-------
0 | | zero
1 | 4 | one
2 | 3 | two
3 | 2 | three
4 | 1 | four
5 | 0 | five
6 | 6 | six
7 | 7 | seven
8 | 8 | eight
| | null
| 0 | zero
(11 rows)
-- start_ignore
create table join_tab2 ( i integer, k integer);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -203,22 +175,7 @@ INSERT INTO join_tab2 VALUES (5, -5);
INSERT INTO join_tab2 VALUES (0, NULL);
INSERT INTO join_tab2 VALUES (NULL, NULL);
INSERT INTO join_tab2 VALUES (NULL, 0);
-- end_ignore
select * from join_tab2;
i | k
---+----
3 | -3
5 | -5
5 | -5
|
| 0
1 | -1
2 | 2
2 | 4
0 |
(9 rows)
commit;
select * from ( SELECT '' AS "col", * FROM join_tab1 AS tx)A;
col | i | j | t
-----+---+---+-------
......@@ -328,7 +285,6 @@ select 'abc' = any('{abc,d,e}');
(1 row)
-- start_ignore
create table subq_abc(a int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -336,116 +292,90 @@ insert into subq_abc values(1);
insert into subq_abc values(9);
insert into subq_abc values(3);
insert into subq_abc values(6);
-- end_ignore
select * from subq_abc;
a
---
9
1
3
6
(4 rows)
SELECT 9 = any (select * from subq_abc);
?column?
----------
t
(1 row)
select null::int >= any ('{}');
?column?
----------
f
(1 row)
select 'abc' = any('{" "}');
?column?
----------
f
(1 row)
select 33.4 = any (array[1,2,3]);
?column?
----------
f
(1 row)
select 40 = all ('{3,4,40,10}');
?column?
----------
f
(1 row)
select 55 >= all ('{1,2,55}');
?column?
----------
t
(1 row)
select 25 = all ('{25,25,25}');
?column?
----------
t
(1 row)
select 'abc' = all('{abc}');
?column?
----------
t
(1 row)
select 'abc' = all('{abc,d,e}');
?column?
----------
f
(1 row)
select 'abc' = all('{"abc"}');
?column?
----------
t
(1 row)
select 'abc' = all('{" "}');
?column?
----------
f
(1 row)
select null::int >= all ('{1,2,33}');
?column?
----------
(1 row)
select null::int >= all ('{}');
?column?
----------
t
(1 row)
select 33.4 > all (array[1,2,3]);
?column?
----------
t
(1 row)
-- start_ignore
create table emp_list(empid int,name char(20),sal float);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'empid' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -454,18 +384,6 @@ insert into emp_list values(2,'emptwo',2000);
insert into emp_list values(3,'empthree',3000);
insert into emp_list values(4,'empfour',4000);
insert into emp_list values(5,'empfive',4000);
-- end_ignore
select * from emp_list;
empid | name | sal
-------+----------------------+------
1 | empone | 1000
2 | emptwo | 2000
3 | empthree | 3000
4 | empfour | 4000
5 | empfive | 4000
(5 rows)
select name from emp_list where sal=(select max(sal) from emp_list);
name
----------------------
......@@ -528,8 +446,7 @@ select g2,count(*) from (select I, count(*) as g2 from join_tab1 group by I) as
1 | 9
(2 rows)
-- start_ignore
begin;
create table join_tab4 ( i integer, j integer, t text);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -540,20 +457,7 @@ insert into join_tab4 values (4,4,'wedday');
insert into join_tab4 values (5,3,'thuday');
insert into join_tab4 values (6,2,'friday');
insert into join_tab4 values (7,1,'satday');
-- end_ignore
select * from join_tab4;
i | j | t
---+---+--------
1 | 7 | sunday
2 | 6 | monday
3 | 5 | tueday
4 | 4 | wedday
5 | 3 | thuday
6 | 2 | friday
7 | 1 | satday
(7 rows)
commit;
select i,j,t from (select * from (select i,j,t from join_tab1)as dtab1
UNION select * from(select i,j,t from join_tab4) as dtab2 )as mtab;
i | j | t
......@@ -591,58 +495,20 @@ ERROR: more than one row returned by a subquery used as an expression
--
-- Testing NOT-IN Subquery
--
-- start_ignore
--
create table Tbl8352_t1(a int, b int) distributed by (a);
create table Tbl8352_t2(a int, b int) distributed by (a);
insert into Tbl8352_t1 values(1,null),(null,1),(1,1),(null,null);
-- end_ignore
select * from Tbl8352_t1 order by 1,2;
a | b
---+---
1 | 1
1 |
| 1
|
(4 rows)
-- start_ignore
insert into Tbl8352_t2 values(1,1);
-- end_ignore
select * from Tbl8352_t2;
a | b
---+---
1 | 1
(1 row)
select * from Tbl8352_t1 where (Tbl8352_t1.a,Tbl8352_t1.b) not in (select Tbl8352_t2.a,Tbl8352_t2.b from Tbl8352_t2);
a | b
---+---
(0 rows)
-- start_ignore
create table Tbl8352_t1a(a int, b int) distributed by (a);
create table Tbl8352_t2a(a int, b int) distributed by (a);
insert into Tbl8352_t1a values(1,2),(3,null),(null,4),(null,null);
-- end_ignore
select * from Tbl8352_t1a order by 1,2;
a | b
---+---
1 | 2
3 |
| 4
|
(4 rows)
-- start_ignore
insert into Tbl8352_t2a values(1,2);
-- end_ignore
select * from Tbl8352_t2a;
a | b
---+---
1 | 2
(1 row)
select * from Tbl8352_t1a where (Tbl8352_t1a.a,Tbl8352_t1a.b) not in (select Tbl8352_t2a.a,Tbl8352_t2a.b from Tbl8352_t2a) order by 1,2;
a | b
---+---
......@@ -662,7 +528,7 @@ select (3,null::int) not in (select 1,1);
t
(1 row)
-- start_ignore
begin;
create table t1(a int, b int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -691,7 +557,7 @@ create table i2(a int, b int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into i1 values(1,2);
-- end_ignore
commit;
--
-- not in subquery involving vars from different rels with inner join
--
......@@ -782,7 +648,7 @@ select t1.a,t2.b from t1 left join (t2 inner join t3 on (t3.a not in (select t4.
5 |
(3 rows)
-- start_ignore
begin;
create table Tbl01(a int, b int, c int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -799,7 +665,7 @@ create or replace function foo(int) returns int as $$
else null::int
end;
$$ language sql immutable;
-- end_ignore
commit;
select Tbl01.*,foo(Tbl01.a) as foo from Tbl01; -- showing foo values
a | b | c | foo
---+----+----+-----
......@@ -815,47 +681,31 @@ select Tbl01.* from Tbl01 where foo(Tbl01.a) not in (select a from Tbl03);
| 11 | 12
(1 row)
-- start_ignore
create table Tbl02 as select Tbl01.*,foo(Tbl01.a) as foo from Tbl01;
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
-- end_ignore
select Tbl02.* from Tbl02 where foo not in (select a from Tbl03);
a | b | c | foo
---+----+----+-----
| 11 | 12 | 13
(1 row)
-- start_ignore
begin;
create table Tbl04(a int, b int);
CREATE TABLE
insert into Tbl04 values(1,2),(3,4),(5,6);
INSERT 0 3
create table Tbl05(a int, b int);
CREATE TABLE
insert into Tbl05 values(1,2);
INSERT 0 1
create table Tbl06(a int, b int);
CREATE TABLE
insert into Tbl06 values(1,2),(3,4);
INSERT 0 2
create table i3(a int not null, b int not null);
CREATE TABLE
insert into i3 values(1,2);
INSERT 0 1
create table Tbl07(a int, b int);
CREATE TABLE
insert into Tbl07 values(1,2),(3,4),(null,null);
INSERT 0 3
create table Tbl08(a int, b int);
CREATE TABLE
insert into Tbl08 values(1,2),(3,4),(null,null);
INSERT 0 3
create table Tbl09(a int, b int);
CREATE TABLE
insert into Tbl09 values(1,2),(5,null),(null,8);
INSERT 0 3
-- end_ignore
commit;
--
-- Positive cases: We should be inferring non-nullability of the not-in subquery. This should result in HLASJ.
--
......@@ -1146,20 +996,12 @@ select Tbl04.* from Tbl04 where (Tbl04.a,Tbl04.b) not in (select Tbl05.a,Tbl05.b
(2 rows)
-- additional queries
-- start_ignore
drop table if exists Tbl04;
DROP TABLE
create table Tbl04(x int, y int);
CREATE TABLE
insert into Tbl04 values(1,2);
INSERT 0 1
insert into Tbl04 values(3,4);
INSERT 0 1
create table Tbl10(x int, y int);
CREATE TABLE
insert into Tbl10 values(1,null);
INSERT 0 1
-- end_ignore
select * from Tbl04 where (x,y) not in (select x,y from Tbl10);
x | y
---+---
......@@ -1178,17 +1020,14 @@ select * from tbl10 where y not in (select 1 where false);
1 |
(1 row)
-- start_ignore
alter table Tbl10 alter column x set not null;
ALTER TABLE
-- end_ignore
select * from Tbl04 where (x,y) not in (select x,y from Tbl10);
x | y
---+---
3 | 4
(1 row)
-- start_ignore
begin;
create table TblText1(a text, b text);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -1205,7 +1044,7 @@ insert into TblText1 values('tushar','pednekar');
insert into TblText2 select * from TblText1;
insert into TblText3 values('florian','waas');
insert into TblText3 values('oak','barrett');
-- end_ignore
commit;
SELECT TblText1.a, TblText2.b FROM TblText1 JOIN TblText2 ON TblText1.a = TblText2.a WHERE ((NOT (TblText1.a, TblText2.b) IN (SELECT TblText3.a, TblText3.b FROM TblText3)));
a | b
--------+----------
......@@ -1223,22 +1062,15 @@ SELECT TblText1.a, TblText2.b FROM TblText1 JOIN TblText2 ON TblText1.a = TblTex
--
-- Delete
--
-- start_ignore
begin;
create table TabDel1(a int, b int);
CREATE TABLE
insert into TabDel1 values(1,2),(3,4),(5,6);
INSERT 0 3
create table TabDel2 as select * from TabDel1;
SELECT 3
create table TabDel3(a int, b int);
CREATE TABLE
insert into TabDel3 values(1,2);
INSERT 0 1
create table TabDel4(a int not null, b int not null);
CREATE TABLE
insert into TabDel4 values(1,2);
INSERT 0 1
-- end_ignore
commit;
explain delete from TabDel1 where TabDel1.a not in (select a from TabDel3); -- do not support this because we produce NLASJ
QUERY PLAN
-------------------------------------------------------------------------------------------------------
......@@ -1265,10 +1097,7 @@ explain delete from TabDel2 where TabDel2.a not in (select a from TabDel4); -- s
Optimizer status: legacy query optimizer
(7 rows)
-- start_ignore
delete from TabDel2 where TabDel2.a not in (select a from TabDel4);
DELETE 2
-- end_ignore
select * from TabDel2;
a | b
---+---
......@@ -1278,7 +1107,7 @@ select * from TabDel2;
--
-- Update
--
-- start_ignore
begin;
create table TblUp1(a int, b int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -1294,7 +1123,7 @@ create table TblUp4(a int not null, b int not null);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into TblUp4 values(1,2);
-- end_ignore
commit;
-- planner does not support updates on distribution keys
update TblUp1 set a=100 where a not in (select a from TblUp3);
select * from TblUp1;
......@@ -1317,7 +1146,7 @@ select * from TblUp2;
--
-- Check for correct results for subqueries nested inside a scalar expression
--
-- start_ignore
begin;
create table subselect_tab1 (a int, b text, c int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -1331,7 +1160,7 @@ insert into subselect_tab1 VALUES (100, 'false', 1);
insert into subselect_tab1 VALUES (200, 'true', 2);
insert into subselect_tab2 VALUES (2,2,2);
insert into subselect_tab3 VALUES (200, 'falseg', 1);
-- end_ignore
commit;
-- scalar subquery in a null test expression
select * from subselect_tab1 where (select b from subselect_tab2) is null;
a | b | c
......@@ -1389,14 +1218,6 @@ SELECT * FROM subselect_tab3 WHERE (NOT EXISTS(SELECT c FROM subselect_tab2)) IN
-- Test to verify that planner for subqueries, generates different copy of SubPlans referring to the same initplan
-- and does not Assert on the subplan's being same
-- start_ignore
drop table if exists append_rel2;
NOTICE: table "append_rel2" does not exist, skipping
drop table if exists append_rel1;
NOTICE: table "append_rel1" does not exist, skipping
drop table if exists append_rel;
NOTICE: table "append_rel" does not exist, skipping
-- end_ignore
create table append_rel(att1 int, att2 int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'att1' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -1494,6 +1315,5 @@ with test as (select * from (select * from append_rel) p where att1 in (select a
20
(1 row)
-- start_ignore
set client_min_messages='warning';
drop schema qp_subquery cascade;
-- end_ignore
-- start_ignore
create schema qp_subquery;
set search_path to qp_subquery;
CREATE TABLE SUBSELECT_TBL1 (
f1 integer,
f2 integer,
f3 float
);
begin;
CREATE TABLE SUBSELECT_TBL1 (f1 integer, f2 integer, f3 float);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
INSERT INTO SUBSELECT_TBL1 VALUES (1, 2, 3);
INSERT INTO SUBSELECT_TBL1 VALUES (2, 3, 4);
INSERT INTO SUBSELECT_TBL1 VALUES (3, 4, 5);
......@@ -16,8 +11,8 @@ INSERT INTO SUBSELECT_TBL1 VALUES (1, 1, 1);
INSERT INTO SUBSELECT_TBL1 VALUES (2, 2, 2);
INSERT INTO SUBSELECT_TBL1 VALUES (3, 3, 3);
INSERT INTO SUBSELECT_TBL1 VALUES (6, 7, 8);
INSERT INTO SUBSELECT_TBL1 VALUES (8, 9, NULL);
-- end_ignore
INSERT INTO SUBSELECT_TBL1 VALUES (8, 9, NULL);
commit;
SELECT '' AS eight, * FROM SUBSELECT_TBL1 ORDER BY 2,3,4;
eight | f1 | f2 | f3
-------+----+----+----
......@@ -115,7 +110,6 @@ SELECT '' AS six, f1 AS "Correlated Field", f2 AS "Second Field"
| 3 | 3
(6 rows)
SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field"
FROM SUBSELECT_TBL1 upper
WHERE f1 IN
......@@ -129,7 +123,6 @@ SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field"
| 3 | 3
(5 rows)
SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field"
FROM SUBSELECT_TBL1 upper
WHERE f3 IN (SELECT upper.f1 + f2 FROM SUBSELECT_TBL1
......@@ -142,7 +135,6 @@ SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field"
| 6 | 8
(4 rows)
SELECT '' AS five, f1 AS "Correlated Field"
FROM SUBSELECT_TBL1
WHERE (f1, f2) IN (SELECT f2, CAST(f3 AS int4) FROM SUBSELECT_TBL1
......@@ -156,8 +148,7 @@ SELECT '' AS five, f1 AS "Correlated Field"
| 2
(5 rows)
-- start_ignore
begin;
create table join_tab1 ( i integer, j integer, t text);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -172,25 +163,6 @@ INSERT INTO join_tab1 VALUES (8, 8, 'eight');
INSERT INTO join_tab1 VALUES (0, NULL, 'zero');
INSERT INTO join_tab1 VALUES (NULL, NULL, 'null');
INSERT INTO join_tab1 VALUES (NULL, 0, 'zero');
-- end_ignore
select * from join_tab1 order by i, t;
i | j | t
---+---+-------
0 | | zero
1 | 4 | one
2 | 3 | two
3 | 2 | three
4 | 1 | four
5 | 0 | five
6 | 6 | six
7 | 7 | seven
8 | 8 | eight
| | null
| 0 | zero
(11 rows)
-- start_ignore
create table join_tab2 ( i integer, k integer);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -203,22 +175,7 @@ INSERT INTO join_tab2 VALUES (5, -5);
INSERT INTO join_tab2 VALUES (0, NULL);
INSERT INTO join_tab2 VALUES (NULL, NULL);
INSERT INTO join_tab2 VALUES (NULL, 0);
-- end_ignore
select * from join_tab2;
i | k
---+----
1 | -1
2 | 2
2 | 4
0 |
3 | -3
5 | -5
5 | -5
|
| 0
(9 rows)
commit;
select * from ( SELECT '' AS "col", * FROM join_tab1 AS tx)A;
col | i | j | t
-----+---+---+-------
......@@ -328,7 +285,6 @@ select 'abc' = any('{abc,d,e}');
(1 row)
-- start_ignore
create table subq_abc(a int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -336,116 +292,90 @@ insert into subq_abc values(1);
insert into subq_abc values(9);
insert into subq_abc values(3);
insert into subq_abc values(6);
-- end_ignore
select * from subq_abc;
a
---
9
1
3
6
(4 rows)
SELECT 9 = any (select * from subq_abc);
?column?
----------
t
(1 row)
select null::int >= any ('{}');
?column?
----------
f
(1 row)
select 'abc' = any('{" "}');
?column?
----------
f
(1 row)
select 33.4 = any (array[1,2,3]);
?column?
----------
f
(1 row)
select 40 = all ('{3,4,40,10}');
?column?
----------
f
(1 row)
select 55 >= all ('{1,2,55}');
?column?
----------
t
(1 row)
select 25 = all ('{25,25,25}');
?column?
----------
t
(1 row)
select 'abc' = all('{abc}');
?column?
----------
t
(1 row)
select 'abc' = all('{abc,d,e}');
?column?
----------
f
(1 row)
select 'abc' = all('{"abc"}');
?column?
----------
t
(1 row)
select 'abc' = all('{" "}');
?column?
----------
f
(1 row)
select null::int >= all ('{1,2,33}');
?column?
----------
(1 row)
select null::int >= all ('{}');
?column?
----------
t
(1 row)
select 33.4 > all (array[1,2,3]);
?column?
----------
t
(1 row)
-- start_ignore
create table emp_list(empid int,name char(20),sal float);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'empid' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -454,18 +384,6 @@ insert into emp_list values(2,'emptwo',2000);
insert into emp_list values(3,'empthree',3000);
insert into emp_list values(4,'empfour',4000);
insert into emp_list values(5,'empfive',4000);
-- end_ignore
select * from emp_list;
empid | name | sal
-------+----------------------+------
1 | empone | 1000
2 | emptwo | 2000
3 | empthree | 3000
4 | empfour | 4000
5 | empfive | 4000
(5 rows)
select name from emp_list where sal=(select max(sal) from emp_list);
name
----------------------
......@@ -528,8 +446,7 @@ select g2,count(*) from (select I, count(*) as g2 from join_tab1 group by I) as
2 | 1
(2 rows)
-- start_ignore
begin;
create table join_tab4 ( i integer, j integer, t text);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -540,20 +457,7 @@ insert into join_tab4 values (4,4,'wedday');
insert into join_tab4 values (5,3,'thuday');
insert into join_tab4 values (6,2,'friday');
insert into join_tab4 values (7,1,'satday');
-- end_ignore
select * from join_tab4;
i | j | t
---+---+--------
1 | 7 | sunday
2 | 6 | monday
3 | 5 | tueday
4 | 4 | wedday
5 | 3 | thuday
6 | 2 | friday
7 | 1 | satday
(7 rows)
commit;
select i,j,t from (select * from (select i,j,t from join_tab1)as dtab1
UNION select * from(select i,j,t from join_tab4) as dtab2 )as mtab;
i | j | t
......@@ -592,58 +496,20 @@ DETAIL: Expected no more than one row to be returned by expression
--
-- Testing NOT-IN Subquery
--
-- start_ignore
--
create table Tbl8352_t1(a int, b int) distributed by (a);
create table Tbl8352_t2(a int, b int) distributed by (a);
insert into Tbl8352_t1 values(1,null),(null,1),(1,1),(null,null);
-- end_ignore
select * from Tbl8352_t1 order by 1,2;
a | b
---+---
1 | 1
1 |
| 1
|
(4 rows)
-- start_ignore
insert into Tbl8352_t2 values(1,1);
-- end_ignore
select * from Tbl8352_t2;
a | b
---+---
1 | 1
(1 row)
select * from Tbl8352_t1 where (Tbl8352_t1.a,Tbl8352_t1.b) not in (select Tbl8352_t2.a,Tbl8352_t2.b from Tbl8352_t2);
a | b
---+---
(0 rows)
-- start_ignore
create table Tbl8352_t1a(a int, b int) distributed by (a);
create table Tbl8352_t2a(a int, b int) distributed by (a);
insert into Tbl8352_t1a values(1,2),(3,null),(null,4),(null,null);
-- end_ignore
select * from Tbl8352_t1a order by 1,2;
a | b
---+---
1 | 2
3 |
| 4
|
(4 rows)
-- start_ignore
insert into Tbl8352_t2a values(1,2);
-- end_ignore
select * from Tbl8352_t2a;
a | b
---+---
1 | 2
(1 row)
select * from Tbl8352_t1a where (Tbl8352_t1a.a,Tbl8352_t1a.b) not in (select Tbl8352_t2a.a,Tbl8352_t2a.b from Tbl8352_t2a) order by 1,2;
a | b
---+---
......@@ -663,7 +529,7 @@ select (3,null::int) not in (select 1,1);
t
(1 row)
-- start_ignore
begin;
create table t1(a int, b int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -692,7 +558,7 @@ create table i2(a int, b int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into i1 values(1,2);
-- end_ignore
commit;
--
-- not in subquery involving vars from different rels with inner join
--
......@@ -783,7 +649,7 @@ select t1.a,t2.b from t1 left join (t2 inner join t3 on (t3.a not in (select t4.
5 |
(3 rows)
-- start_ignore
begin;
create table Tbl01(a int, b int, c int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -800,7 +666,7 @@ create or replace function foo(int) returns int as $$
else null::int
end;
$$ language sql immutable;
-- end_ignore
commit;
select Tbl01.*,foo(Tbl01.a) as foo from Tbl01; -- showing foo values
a | b | c | foo
---+----+----+-----
......@@ -816,47 +682,31 @@ select Tbl01.* from Tbl01 where foo(Tbl01.a) not in (select a from Tbl03);
| 11 | 12
(1 row)
-- start_ignore
create table Tbl02 as select Tbl01.*,foo(Tbl01.a) as foo from Tbl01;
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
-- end_ignore
select Tbl02.* from Tbl02 where foo not in (select a from Tbl03);
a | b | c | foo
---+----+----+-----
| 11 | 12 | 13
(1 row)
-- start_ignore
begin;
create table Tbl04(a int, b int);
CREATE TABLE
insert into Tbl04 values(1,2),(3,4),(5,6);
INSERT 0 3
create table Tbl05(a int, b int);
CREATE TABLE
insert into Tbl05 values(1,2);
INSERT 0 1
create table Tbl06(a int, b int);
CREATE TABLE
insert into Tbl06 values(1,2),(3,4);
INSERT 0 2
create table i3(a int not null, b int not null);
CREATE TABLE
insert into i3 values(1,2);
INSERT 0 1
create table Tbl07(a int, b int);
CREATE TABLE
insert into Tbl07 values(1,2),(3,4),(null,null);
INSERT 0 3
create table Tbl08(a int, b int);
CREATE TABLE
insert into Tbl08 values(1,2),(3,4),(null,null);
INSERT 0 3
create table Tbl09(a int, b int);
CREATE TABLE
insert into Tbl09 values(1,2),(5,null),(null,8);
INSERT 0 3
-- end_ignore
commit;
--
-- Positive cases: We should be inferring non-nullability of the not-in subquery. This should result in HLASJ.
--
......@@ -1147,20 +997,12 @@ select Tbl04.* from Tbl04 where (Tbl04.a,Tbl04.b) not in (select Tbl05.a,Tbl05.b
(2 rows)
-- additional queries
-- start_ignore
drop table if exists Tbl04;
DROP TABLE
create table Tbl04(x int, y int);
CREATE TABLE
insert into Tbl04 values(1,2);
INSERT 0 1
insert into Tbl04 values(3,4);
INSERT 0 1
create table Tbl10(x int, y int);
CREATE TABLE
insert into Tbl10 values(1,null);
INSERT 0 1
-- end_ignore
select * from Tbl04 where (x,y) not in (select x,y from Tbl10);
x | y
---+---
......@@ -1179,17 +1021,14 @@ select * from tbl10 where y not in (select 1 where false);
1 |
(1 row)
-- start_ignore
alter table Tbl10 alter column x set not null;
ALTER TABLE
-- end_ignore
select * from Tbl04 where (x,y) not in (select x,y from Tbl10);
x | y
---+---
3 | 4
(1 row)
-- start_ignore
begin;
create table TblText1(a text, b text);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -1206,7 +1045,7 @@ insert into TblText1 values('tushar','pednekar');
insert into TblText2 select * from TblText1;
insert into TblText3 values('florian','waas');
insert into TblText3 values('oak','barrett');
-- end_ignore
commit;
SELECT TblText1.a, TblText2.b FROM TblText1 JOIN TblText2 ON TblText1.a = TblText2.a WHERE ((NOT (TblText1.a, TblText2.b) IN (SELECT TblText3.a, TblText3.b FROM TblText3)));
a | b
--------+----------
......@@ -1224,22 +1063,15 @@ SELECT TblText1.a, TblText2.b FROM TblText1 JOIN TblText2 ON TblText1.a = TblTex
--
-- Delete
--
-- start_ignore
begin;
create table TabDel1(a int, b int);
CREATE TABLE
insert into TabDel1 values(1,2),(3,4),(5,6);
INSERT 0 3
create table TabDel2 as select * from TabDel1;
SELECT 3
create table TabDel3(a int, b int);
CREATE TABLE
insert into TabDel3 values(1,2);
INSERT 0 1
create table TabDel4(a int not null, b int not null);
CREATE TABLE
insert into TabDel4 values(1,2);
INSERT 0 1
-- end_ignore
commit;
explain delete from TabDel1 where TabDel1.a not in (select a from TabDel3); -- do not support this because we produce NLASJ
QUERY PLAN
---------------------------------------------------------------------------------------------------------
......@@ -1269,10 +1101,7 @@ explain delete from TabDel2 where TabDel2.a not in (select a from TabDel4); -- s
Optimizer: PQO version 2.74.0
(10 rows)
-- start_ignore
delete from TabDel2 where TabDel2.a not in (select a from TabDel4);
DELETE 2
-- end_ignore
select * from TabDel2;
a | b
---+---
......@@ -1282,7 +1111,7 @@ select * from TabDel2;
--
-- Update
--
-- start_ignore
begin;
create table TblUp1(a int, b int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -1297,7 +1126,7 @@ create table TblUp4(a int not null, b int not null);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into TblUp4 values(1,2);
-- end_ignore
commit;
-- planner does not support updates on distribution keys
update TblUp1 set a=100 where a not in (select a from TblUp3);
select * from TblUp1;
......@@ -1320,7 +1149,7 @@ select * from TblUp2;
--
-- Check for correct results for subqueries nested inside a scalar expression
--
-- start_ignore
begin;
create table subselect_tab1 (a int, b text, c int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -1334,7 +1163,7 @@ insert into subselect_tab1 VALUES (100, 'false', 1);
insert into subselect_tab1 VALUES (200, 'true', 2);
insert into subselect_tab2 VALUES (2,2,2);
insert into subselect_tab3 VALUES (200, 'falseg', 1);
-- end_ignore
commit;
-- scalar subquery in a null test expression
select * from subselect_tab1 where (select b from subselect_tab2) is null;
a | b | c
......@@ -1392,14 +1221,6 @@ SELECT * FROM subselect_tab3 WHERE (NOT EXISTS(SELECT c FROM subselect_tab2)) IN
-- Test to verify that planner for subqueries, generates different copy of SubPlans referring to the same initplan
-- and does not Assert on the subplan's being same
-- start_ignore
drop table if exists append_rel2;
NOTICE: table "append_rel2" does not exist, skipping
drop table if exists append_rel1;
NOTICE: table "append_rel1" does not exist, skipping
drop table if exists append_rel;
NOTICE: table "append_rel" does not exist, skipping
-- end_ignore
create table append_rel(att1 int, att2 int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'att1' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
......@@ -1497,6 +1318,5 @@ with test as (select * from (select * from append_rel) p where att1 in (select a
20
(1 row)
-- start_ignore
set client_min_messages='warning';
drop schema qp_subquery cascade;
-- end_ignore
......@@ -98,24 +98,12 @@ SELECT * FROM TIMESTAMP_MONTH_listp WHERE f2 = '2000-01-03';
SELECT * FROM TIMESTAMP_MONTH_listp WHERE f2 = TO_TIMESTAMP('2000-01-03', 'YYYY-MM-DD');
SELECT * FROM TIMESTAMP_MONTH_listp WHERE f2 = TO_DATE('2000-01-03', 'YYYY-MM-DD');
-- CLEANUP
-- start_ignore
DROP TABLE TIMESTAMP_MONTH_listp;
DROP TABLE TIMESTAMP_MONTH_rangep_STARTEXCL;
DROP TABLE TIMESTAMP_MONTH_rangep_STARTINCL;
-- end_ignore
--
-- Data Engineer can see partition key in psql
--
-- SETUP
-- start_ignore
DROP TABLE IF EXISTS T26002_T1;
DROP TABLE IF EXISTS T26002_T2;
CREATE TABLE T26002_T1 (empid int, departmentid int, year int, region varchar(20))
DISTRIBUTED BY (empid)
PARTITION BY RANGE (year)
......@@ -127,7 +115,6 @@ DISTRIBUTED BY (empid)
DEFAULT SUBPARTITION other_regions)
( START (2012) END (2015) EVERY (3),
DEFAULT PARTITION outlying_years);
-- end_ignore
-- TEST
-- expected to see the partition key
......@@ -152,23 +139,13 @@ DISTRIBUTED BY (empid);
\d+ T26002_T2;
-- CLEANUP
-- start_ignore
DROP TABLE IF EXISTS T26002_T1;
DROP TABLE IF EXISTS T26002_T2;
-- end_ignore
--
-- Testing whether test gives wrong results with partition tables when sub-partitions are distributed differently than the parent partition.
-- Test whether test gives wrong results with partition tables when
-- sub-partitions are distributed differently than the parent partition.
--
-- SETUP
-- start_ignore
drop table if exists pt;
drop table if exists t;
-- end_ignore
create table pt(a int, b int, c int) distributed by (a) partition by range(b) (start(0) end(10) every (2));
alter table pt_1_prt_1 set distributed randomly;
......@@ -190,21 +167,12 @@ select a, count(*) from pt group by a;
select b, count(*) from pt group by b;
select a, count(*) from pt where a<2 group by a;
-- CLEANUP
drop index pt_c;
drop table if exists pt;
drop table if exists t;
--
-- Partition table with appendonly leaf, full join
--
-- SETUP
-- start_ignore
DROP TABLE IF EXISTS foo;
DROP TABLE IF EXISTS bar;
CREATE TABLE foo (a int);
CREATE TABLE bar (b int, c int)
......@@ -218,27 +186,19 @@ PARTITION BY RANGE (b)
START (1) END (10) ,
START (10) END (20)
);
-- end_ignore
INSERT INTO foo VALUES (1);
INSERT INTO bar VALUES (2,3);
SELECT * FROM foo FULL JOIN bar ON foo.a = bar.b;
-- CLEANUP
-- start_ignore
DROP TABLE IF EXISTS foo;
DROP TABLE IF EXISTS bar;
-- end_ignore
DROP TABLE IF EXISTS foo, bar;
--
-- Partition table with appendonly set at middlevel partition, full join
--
-- SETUP
-- start_ignore
DROP TABLE IF EXISTS foo;
DROP TABLE IF EXISTS bar;
CREATE TABLE foo (a int);
CREATE TABLE bar (b int, c int)
......@@ -252,27 +212,19 @@ PARTITION BY RANGE (b)
START (1) END (10) WITH (appendonly=true),
START (10) END (20)
);
-- end_ignore
INSERT INTO foo VALUES (1);
INSERT INTO bar VALUES (2,3);
SELECT * FROM foo FULL JOIN bar ON foo.a = bar.b;
-- CLEANUP
-- start_ignore
DROP TABLE IF EXISTS foo;
DROP TABLE IF EXISTS bar;
-- end_ignore
DROP TABLE IF EXISTS foo, bar;
--
-- Partition table with appendonly set at root partition, full join
--
-- SETUP
-- start_ignore
DROP TABLE IF EXISTS foo;
DROP TABLE IF EXISTS bar;
CREATE TABLE foo (a int);
CREATE TABLE bar (b int, c int) WITH (appendonly=true)
......@@ -286,7 +238,6 @@ PARTITION BY RANGE (b)
START (1) END (10),
START (10) END (20)
);
-- end_ignore
INSERT INTO foo VALUES (1);
INSERT INTO bar VALUES (2,3);
......@@ -1663,13 +1614,9 @@ select c1, dt, count(*) from mpp6724 group by 1,2 having count(*) > 1;
drop table mpp6724;
-- Test for partition cleanup
-- start_ignore
drop schema partition_999 cascade;
create schema partition_999;
set search_path=bfv_partition,partition_999;
-- end_ignore
create table partition_cleanup1 (a int, b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int)
partition by range (a)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册