From 75c075095274047df7d7320fcb919346e873c4dc Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Wed, 20 Mar 2019 19:24:55 +0100 Subject: [PATCH] Combine expand hypertable plan and result tests --- .gitignore | 2 +- ...d-10.out => plan_expand_hypertable-10.out} | 3 +++ ...d-11.out => plan_expand_hypertable-11.out} | 3 +++ ...9.6.out => plan_expand_hypertable-9.6.out} | 3 +++ .../plan_expand_hypertable_results_diff.out | 9 ------- test/sql/CMakeLists.txt | 4 +-- ...diff.sql => plan_expand_hypertable.sql.in} | 25 ++++++++----------- .../plan_expand_hypertable_optimized.sql.in | 9 ------- 8 files changed, 22 insertions(+), 36 deletions(-) rename test/expected/{plan_expand_hypertable_optimized-10.out => plan_expand_hypertable-10.out} (99%) rename test/expected/{plan_expand_hypertable_optimized-11.out => plan_expand_hypertable-11.out} (99%) rename test/expected/{plan_expand_hypertable_optimized-9.6.out => plan_expand_hypertable-9.6.out} (99%) delete mode 100644 test/expected/plan_expand_hypertable_results_diff.out rename test/sql/{plan_expand_hypertable_results_diff.sql => plan_expand_hypertable.sql.in} (65%) delete mode 100644 test/sql/plan_expand_hypertable_optimized.sql.in diff --git a/.gitignore b/.gitignore index 306ab2de9..380a98d98 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ typedef.list /.vs /test/sql/parallel-*.sql /test/sql/plan_ordered_append-*.sql -/test/sql/plan_expand_hypertable_optimized-*.sql +/test/sql/plan_expand_hypertable-*.sql /test/sql/plan_hashagg-*.sql /test/sql/agg_bookends_optimized-*.sql /test/sql/alternate_users-*.sql diff --git a/test/expected/plan_expand_hypertable_optimized-10.out b/test/expected/plan_expand_hypertable-10.out similarity index 99% rename from test/expected/plan_expand_hypertable_optimized-10.out rename to test/expected/plan_expand_hypertable-10.out index 19b9faeda..49eed0f99 100644 --- a/test/expected/plan_expand_hypertable_optimized-10.out +++ b/test/expected/plan_expand_hypertable-10.out @@ -1229,3 +1229,6 @@ SELECT * FROM hyper h WHERE _timescaledb_internal.chunks_in(h, NULL); :PREFIX SELECT * FROM hyper h WHERE _timescaledb_internal.chunks_in(h, ARRAY[NULL::int]); psql:include/plan_expand_hypertable_chunks_in_query.sql:38: ERROR: chunk id can't be NULL +\set ECHO errors +507 +507 diff --git a/test/expected/plan_expand_hypertable_optimized-11.out b/test/expected/plan_expand_hypertable-11.out similarity index 99% rename from test/expected/plan_expand_hypertable_optimized-11.out rename to test/expected/plan_expand_hypertable-11.out index 205e3b2e8..5bb57a57b 100644 --- a/test/expected/plan_expand_hypertable_optimized-11.out +++ b/test/expected/plan_expand_hypertable-11.out @@ -1231,3 +1231,6 @@ SELECT * FROM hyper h WHERE _timescaledb_internal.chunks_in(h, NULL); :PREFIX SELECT * FROM hyper h WHERE _timescaledb_internal.chunks_in(h, ARRAY[NULL::int]); psql:include/plan_expand_hypertable_chunks_in_query.sql:38: ERROR: chunk id can't be NULL +\set ECHO errors +507 +507 diff --git a/test/expected/plan_expand_hypertable_optimized-9.6.out b/test/expected/plan_expand_hypertable-9.6.out similarity index 99% rename from test/expected/plan_expand_hypertable_optimized-9.6.out rename to test/expected/plan_expand_hypertable-9.6.out index b606f39c9..63fd70c44 100644 --- a/test/expected/plan_expand_hypertable_optimized-9.6.out +++ b/test/expected/plan_expand_hypertable-9.6.out @@ -1229,3 +1229,6 @@ SELECT * FROM hyper h WHERE _timescaledb_internal.chunks_in(h, NULL); :PREFIX SELECT * FROM hyper h WHERE _timescaledb_internal.chunks_in(h, ARRAY[NULL::int]); psql:include/plan_expand_hypertable_chunks_in_query.sql:38: ERROR: chunk id can't be NULL +\set ECHO errors +507 +507 diff --git a/test/expected/plan_expand_hypertable_results_diff.out b/test/expected/plan_expand_hypertable_results_diff.out deleted file mode 100644 index 5705ef3b3..000000000 --- a/test/expected/plan_expand_hypertable_results_diff.out +++ /dev/null @@ -1,9 +0,0 @@ --- This file and its contents are licensed under the Apache License 2.0. --- Please see the included NOTICE for copyright information and --- LICENSE-APACHE for a copy of the license. -\set ECHO errors - ?column? ----------- - Done -(1 row) - diff --git a/test/sql/CMakeLists.txt b/test/sql/CMakeLists.txt index a9ed216a3..62343fdc4 100644 --- a/test/sql/CMakeLists.txt +++ b/test/sql/CMakeLists.txt @@ -39,7 +39,6 @@ set(TEST_FILES pg_dump.sql pg_dump_unprivileged.sql plain.sql - plan_expand_hypertable_results_diff.sql reindex.sql relocate_extension.sql reloptions.sql @@ -78,7 +77,6 @@ set(POST_TESTS alternate_users-9.6 alternate_users-10 alternate_users-11 - plan_expand_hypertable_results_diff sql_query_results_x_diff ) @@ -131,7 +129,7 @@ set(TEST_TEMPLATES alternate_users.sql.in parallel.sql.in partitioning.sql.in - plan_expand_hypertable_optimized.sql.in + plan_expand_hypertable.sql.in #hashagg is different in 9.6 and 10 because of hashagg parallelism plan_hashagg.sql.in # lateral plans are different across versions, explains run without analyze on 9.6 diff --git a/test/sql/plan_expand_hypertable_results_diff.sql b/test/sql/plan_expand_hypertable.sql.in similarity index 65% rename from test/sql/plan_expand_hypertable_results_diff.sql rename to test/sql/plan_expand_hypertable.sql.in index dc28dd5da..967a3dc9b 100644 --- a/test/sql/plan_expand_hypertable_results_diff.sql +++ b/test/sql/plan_expand_hypertable.sql.in @@ -2,6 +2,12 @@ -- Please see the included NOTICE for copyright information and -- LICENSE-APACHE for a copy of the license. +SET timescaledb.disable_optimizations= 'off'; +\set PREFIX 'EXPLAIN (costs off) ' +\ir include/plan_expand_hypertable_load.sql +\ir include/plan_expand_hypertable_query.sql +\ir include/plan_expand_hypertable_chunks_in_query.sql + \set ECHO errors \set TEST_BASE_NAME plan_expand_hypertable SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') as "TEST_LOAD_NAME", @@ -11,18 +17,11 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') as "TEST_LOAD_NAME", \gset SELECT format('\! diff %s %s', :'TEST_RESULTS_OPTIMIZED', :'TEST_RESULTS_UNOPTIMIZED') as "DIFF_CMD" \gset +-- use input redirect here because filenames are absolute and would be different across installations +SELECT format('\! wc -l <%s; wc -l <%s', :'TEST_RESULTS_OPTIMIZED', :'TEST_RESULTS_UNOPTIMIZED') as "WC_CMD" +\gset - -\o /dev/null -SET client_min_messages = 'error'; -\ir :TEST_LOAD_NAME -RESET client_min_messages; -\o - ---generate the results into two different files -SET client_min_messages = 'error'; -\set ECHO none ---make output contain query results +-- run queries with optimization on and off and diff results \set PREFIX '' \o :TEST_RESULTS_OPTIMIZED SET timescaledb.disable_optimizations= 'off'; @@ -32,8 +31,6 @@ SET timescaledb.disable_optimizations= 'off'; SET timescaledb.disable_optimizations= 'on'; \ir :TEST_QUERY_NAME \o -RESET client_min_messages; :DIFF_CMD - -SELECT 'Done'; +:WC_CMD diff --git a/test/sql/plan_expand_hypertable_optimized.sql.in b/test/sql/plan_expand_hypertable_optimized.sql.in deleted file mode 100644 index 12a148c85..000000000 --- a/test/sql/plan_expand_hypertable_optimized.sql.in +++ /dev/null @@ -1,9 +0,0 @@ --- This file and its contents are licensed under the Apache License 2.0. --- Please see the included NOTICE for copyright information and --- LICENSE-APACHE for a copy of the license. - -SET timescaledb.disable_optimizations= 'off'; -\set PREFIX 'EXPLAIN (costs off) ' -\ir include/plan_expand_hypertable_load.sql -\ir include/plan_expand_hypertable_query.sql -\ir include/plan_expand_hypertable_chunks_in_query.sql