From: Pallavi Sontakke Date: Fri, 12 Feb 2016 12:50:37 +0000 (+0530) Subject: Test sql and output changes for LATERAL issue X-Git-Tag: XL9_5_R1BETA1~22 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=893bdf3baa52cd8135d8939c3f86d6d5e105e793;p=postgres-xl.git Test sql and output changes for LATERAL issue Separate out Issue #73 in Issue Tracker. Accept XL query plans. --- diff --git a/contrib/tsm_system_time/Makefile b/contrib/tsm_system_time/Makefile index 4c08a9935a..0176e9a5dd 100644 --- a/contrib/tsm_system_time/Makefile +++ b/contrib/tsm_system_time/Makefile @@ -7,7 +7,7 @@ PGFILEDESC = "tsm_system_time - TABLESAMPLE method which accepts time in millise EXTENSION = tsm_system_time DATA = tsm_system_time--1.0.sql -REGRESS = tsm_system_time +REGRESS = tsm_system_time xl_known_bugs SHLIB_LINK += $(filter -lm, $(LIBS)) diff --git a/contrib/tsm_system_time/expected/tsm_system_time.out b/contrib/tsm_system_time/expected/tsm_system_time.out index ac44f30be9..02c2ed7262 100644 --- a/contrib/tsm_system_time/expected/tsm_system_time.out +++ b/contrib/tsm_system_time/expected/tsm_system_time.out @@ -21,11 +21,13 @@ SELECT count(*) FROM test_tablesample TABLESAMPLE system_time (100000); -- bad parameters should get through planning, but not execution: EXPLAIN (COSTS OFF) SELECT id FROM test_tablesample TABLESAMPLE system_time (-1); - QUERY PLAN --------------------------------------------------- - Sample Scan on test_tablesample - Sampling: system_time ('-1'::double precision) -(2 rows) + QUERY PLAN +-------------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1, datanode_2 + -> Sample Scan on test_tablesample + Sampling: system_time ('-1'::double precision) +(4 rows) SELECT id FROM test_tablesample TABLESAMPLE system_time (-1); ERROR: sample collection time must not be negative @@ -40,15 +42,17 @@ SELECT * FROM (VALUES (0),(100000)) v(time), LATERAL (SELECT COUNT(*) FROM test_tablesample TABLESAMPLE system_time (100000)) ss; - QUERY PLAN ------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------ Nested Loop -> Aggregate - -> Materialize - -> Sample Scan on test_tablesample - Sampling: system_time ('100000'::double precision) + -> Remote Subquery Scan on all (datanode_1,datanode_2) + -> Aggregate + -> Materialize + -> Sample Scan on test_tablesample + Sampling: system_time ('100000'::double precision) -> Values Scan on "*VALUES*" -(6 rows) +(8 rows) SELECT * FROM (VALUES (0),(100000)) v(time), @@ -65,36 +69,32 @@ SELECT * FROM (VALUES (0),(100000)) v(time), LATERAL (SELECT COUNT(*) FROM test_tablesample TABLESAMPLE system_time (time)) ss; - QUERY PLAN ----------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------- Nested Loop -> Values Scan on "*VALUES*" -> Aggregate - -> Materialize - -> Sample Scan on test_tablesample - Sampling: system_time ("*VALUES*".column1) -(6 rows) - -SELECT * FROM - (VALUES (0),(100000)) v(time), - LATERAL (SELECT COUNT(*) FROM test_tablesample - TABLESAMPLE system_time (time)) ss; - time | count ---------+------- - 0 | 0 - 100000 | 31 -(2 rows) + -> Remote Subquery Scan on all (datanode_1,datanode_2) + -> Aggregate + -> Materialize + -> Sample Scan on test_tablesample + Sampling: system_time ("*VALUES*".column1) +(8 rows) CREATE VIEW vv AS SELECT * FROM test_tablesample TABLESAMPLE system_time (20); EXPLAIN (COSTS OFF) SELECT * FROM vv; - QUERY PLAN --------------------------------------------------- - Sample Scan on test_tablesample - Sampling: system_time ('20'::double precision) -(2 rows) + QUERY PLAN +-------------------------------------------------------- + Remote Subquery Scan on all (datanode_1,datanode_2) + -> Sample Scan on test_tablesample + Sampling: system_time ('20'::double precision) +(3 rows) DROP EXTENSION tsm_system_time; -- fail, view depends on extension ERROR: cannot drop extension tsm_system_time because other objects depend on it DETAIL: view vv depends on function system_time(internal) HINT: Use DROP ... CASCADE to drop the dependent objects too. +DROP VIEW vv; +DROP TABLE test_tablesample; +DROP EXTENSION tsm_system_time; diff --git a/contrib/tsm_system_time/expected/xl_known_bugs.out b/contrib/tsm_system_time/expected/xl_known_bugs.out new file mode 100644 index 0000000000..69998b0dea --- /dev/null +++ b/contrib/tsm_system_time/expected/xl_known_bugs.out @@ -0,0 +1,33 @@ +CREATE EXTENSION tsm_system_time; +CREATE TABLE test_tablesample (id int, name text); +INSERT INTO test_tablesample SELECT i, repeat(i::text, 1000) + FROM generate_series(0, 30) s(i); +EXPLAIN (COSTS OFF) +SELECT * FROM + (VALUES (0),(100000)) v(time), + LATERAL (SELECT COUNT(*) FROM test_tablesample + TABLESAMPLE system_time (time)) ss; + QUERY PLAN +---------------------------------------------------------------------------- + Nested Loop + -> Values Scan on "*VALUES*" + -> Aggregate + -> Remote Subquery Scan on all (datanode_1,datanode_2) + -> Aggregate + -> Materialize + -> Sample Scan on test_tablesample + Sampling: system_time ("*VALUES*".column1) +(8 rows) + +SELECT * FROM + (VALUES (0),(100000)) v(time), + LATERAL (SELECT COUNT(*) FROM test_tablesample + TABLESAMPLE system_time (time)) ss; + time | count +--------+------- + 0 | 0 + 100000 | 31 +(2 rows) + +DROP TABLE test_tablesample; +DROP EXTENSION tsm_system_time; -- fail, view depends on extension diff --git a/contrib/tsm_system_time/sql/tsm_system_time.sql b/contrib/tsm_system_time/sql/tsm_system_time.sql index 117de163d8..1c5e159956 100644 --- a/contrib/tsm_system_time/sql/tsm_system_time.sql +++ b/contrib/tsm_system_time/sql/tsm_system_time.sql @@ -38,14 +38,13 @@ SELECT * FROM LATERAL (SELECT COUNT(*) FROM test_tablesample TABLESAMPLE system_time (time)) ss; -SELECT * FROM - (VALUES (0),(100000)) v(time), - LATERAL (SELECT COUNT(*) FROM test_tablesample - TABLESAMPLE system_time (time)) ss; - CREATE VIEW vv AS SELECT * FROM test_tablesample TABLESAMPLE system_time (20); EXPLAIN (COSTS OFF) SELECT * FROM vv; DROP EXTENSION tsm_system_time; -- fail, view depends on extension + +DROP VIEW vv; +DROP TABLE test_tablesample; +DROP EXTENSION tsm_system_time; diff --git a/contrib/tsm_system_time/sql/xl_known_bugs.sql b/contrib/tsm_system_time/sql/xl_known_bugs.sql new file mode 100644 index 0000000000..2778b70f32 --- /dev/null +++ b/contrib/tsm_system_time/sql/xl_known_bugs.sql @@ -0,0 +1,18 @@ +CREATE EXTENSION tsm_system_time; +CREATE TABLE test_tablesample (id int, name text); +INSERT INTO test_tablesample SELECT i, repeat(i::text, 1000) + FROM generate_series(0, 30) s(i); + +EXPLAIN (COSTS OFF) +SELECT * FROM + (VALUES (0),(100000)) v(time), + LATERAL (SELECT COUNT(*) FROM test_tablesample + TABLESAMPLE system_time (time)) ss; + +SELECT * FROM + (VALUES (0),(100000)) v(time), + LATERAL (SELECT COUNT(*) FROM test_tablesample + TABLESAMPLE system_time (time)) ss; + +DROP TABLE test_tablesample; +DROP EXTENSION tsm_system_time; -- fail, view depends on extension