Skip to content

Commit

Permalink
Fix test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyue-hashdata committed Feb 2, 2025
1 parent c5a6fd2 commit e607900
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
24 changes: 15 additions & 9 deletions src/test/regress/expected/gp_runtime_filter.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
-- start_matchignore
-- m/^.*Extra Text:.*/
-- m/^.*Buckets:.*/
-- end_matchignore
-- Disable ORCA
SET optimizer TO off;
-- Test Suit 1: runtime filter main case
Expand Down Expand Up @@ -251,6 +255,7 @@ SELECT COUNT(*) FROM dim_rf
(1 row)

-- Test bloom filter pushdown
SET enable_parallel TO off;
-- case 1: join on distribution table and replicated table.
DROP TABLE IF EXISTS t1;
NOTICE: table "t1" does not exist, skipping
Expand Down Expand Up @@ -362,24 +367,24 @@ RESET gp_enable_runtime_filter_pushdown;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
-- case 3: bug fix with explain
DROP TABLE IF EXISTS test_tablesample;
NOTICE: table "test_tablesample" does not exist, skipping
CREATE TABLE test_tablesample (dist int, id int, name text) WITH (fillfactor=10) DISTRIBUTED BY (dist);
INSERT INTO test_tablesample SELECT 0, i, repeat(i::text, 875) FROM generate_series(0, 9) s(i) ORDER BY i;
INSERT INTO test_tablesample SELECT 3, i, repeat(i::text, 875) FROM generate_series(10, 19) s(i) ORDER BY i;
INSERT INTO test_tablesample SELECT 5, i, repeat(i::text, 875) FROM generate_series(20, 29) s(i) ORDER BY i;
DROP TABLE IF EXISTS test_tablesample1;
NOTICE: table "test_tablesample1" does not exist, skipping
CREATE TABLE test_tablesample1 (dist int, id int, name text) WITH (fillfactor=10) DISTRIBUTED BY (dist);
INSERT INTO test_tablesample1 SELECT 0, i, repeat(i::text, 875) FROM generate_series(0, 9) s(i) ORDER BY i;
INSERT INTO test_tablesample1 SELECT 3, i, repeat(i::text, 875) FROM generate_series(10, 19) s(i) ORDER BY i;
INSERT INTO test_tablesample1 SELECT 5, i, repeat(i::text, 875) FROM generate_series(20, 29) s(i) ORDER BY i;
SET gp_enable_runtime_filter_pushdown TO on;
EXPLAIN (COSTS OFF) SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (2);
EXPLAIN (COSTS OFF) SELECT id FROM test_tablesample1 TABLESAMPLE SYSTEM (50) REPEATABLE (2);
QUERY PLAN
--------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
-> Sample Scan on test_tablesample
-> Sample Scan on test_tablesample1
Sampling: system ('50'::real) REPEATABLE ('2'::double precision)
Optimizer: Postgres query optimizer
(4 rows)

RESET gp_enable_runtime_filter_pushdown;
DROP TABLE IF EXISTS test_tablesample;
DROP TABLE IF EXISTS test_tablesample1;
-- case 4: show debug info only when gp_enable_runtime_filter_pushdown is on
DROP TABLE IF EXISTS t1;
NOTICE: table "t1" does not exist, skipping
Expand Down Expand Up @@ -536,6 +541,7 @@ RESET gp_enable_runtime_filter_pushdown;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
RESET enable_parallel;
-- Clean up: reset guc
SET gp_enable_runtime_filter TO off;
SET optimizer TO default;
22 changes: 15 additions & 7 deletions src/test/regress/sql/gp_runtime_filter.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
-- start_matchignore
-- m/^.*Extra Text:.*/
-- m/^.*Buckets:.*/
-- end_matchignore
-- Disable ORCA
SET optimizer TO off;

Expand Down Expand Up @@ -76,6 +80,8 @@ SELECT COUNT(*) FROM dim_rf
WHERE dim_rf.did IN (SELECT did FROM fact_rf) AND proj_id < 2;

-- Test bloom filter pushdown
SET enable_parallel TO off;

-- case 1: join on distribution table and replicated table.
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
Expand Down Expand Up @@ -137,17 +143,17 @@ DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;

-- case 3: bug fix with explain
DROP TABLE IF EXISTS test_tablesample;
CREATE TABLE test_tablesample (dist int, id int, name text) WITH (fillfactor=10) DISTRIBUTED BY (dist);
INSERT INTO test_tablesample SELECT 0, i, repeat(i::text, 875) FROM generate_series(0, 9) s(i) ORDER BY i;
INSERT INTO test_tablesample SELECT 3, i, repeat(i::text, 875) FROM generate_series(10, 19) s(i) ORDER BY i;
INSERT INTO test_tablesample SELECT 5, i, repeat(i::text, 875) FROM generate_series(20, 29) s(i) ORDER BY i;
DROP TABLE IF EXISTS test_tablesample1;
CREATE TABLE test_tablesample1 (dist int, id int, name text) WITH (fillfactor=10) DISTRIBUTED BY (dist);
INSERT INTO test_tablesample1 SELECT 0, i, repeat(i::text, 875) FROM generate_series(0, 9) s(i) ORDER BY i;
INSERT INTO test_tablesample1 SELECT 3, i, repeat(i::text, 875) FROM generate_series(10, 19) s(i) ORDER BY i;
INSERT INTO test_tablesample1 SELECT 5, i, repeat(i::text, 875) FROM generate_series(20, 29) s(i) ORDER BY i;

SET gp_enable_runtime_filter_pushdown TO on;
EXPLAIN (COSTS OFF) SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (2);
EXPLAIN (COSTS OFF) SELECT id FROM test_tablesample1 TABLESAMPLE SYSTEM (50) REPEATABLE (2);
RESET gp_enable_runtime_filter_pushdown;

DROP TABLE IF EXISTS test_tablesample;
DROP TABLE IF EXISTS test_tablesample1;

-- case 4: show debug info only when gp_enable_runtime_filter_pushdown is on
DROP TABLE IF EXISTS t1;
Expand Down Expand Up @@ -221,6 +227,8 @@ DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;

RESET enable_parallel;

-- Clean up: reset guc
SET gp_enable_runtime_filter TO off;
SET optimizer TO default;

0 comments on commit e607900

Please sign in to comment.