From ade3e026fa3288e61c7115da9b4dfaf6a60903d4 Mon Sep 17 00:00:00 2001 From: Ivan Lezhankin Date: Fri, 3 Apr 2020 16:54:11 +0300 Subject: [PATCH] Some fixes --- .../00753_comment_columns_zookeeper.sql | 18 +++++++++--------- .../00800_versatile_storage_join.sql | 2 ++ .../00980_create_temporary_live_view.sql | 14 +++++++------- .../01078_merge_tree_read_one_thread.sql | 4 +++- .../0_stateless/01095_tpch_like_smoke.sql | 7 ++----- tests/queries/conftest.py | 2 +- tests/queries/query_test.py | 2 +- tests/queries/server.py | 6 ++++-- 8 files changed, 29 insertions(+), 26 deletions(-) diff --git a/tests/queries/0_stateless/00753_comment_columns_zookeeper.sql b/tests/queries/0_stateless/00753_comment_columns_zookeeper.sql index 03dab0232d9..84238a7e4d6 100644 --- a/tests/queries/0_stateless/00753_comment_columns_zookeeper.sql +++ b/tests/queries/0_stateless/00753_comment_columns_zookeeper.sql @@ -1,20 +1,20 @@ -DROP TABLE IF EXISTS test.check_comments; +DROP TABLE IF EXISTS check_comments; -CREATE TABLE test.check_comments +CREATE TABLE check_comments ( column_name1 UInt8 DEFAULT 1 COMMENT 'comment', column_name2 UInt8 COMMENT 'non default comment' ) ENGINE = ReplicatedMergeTree('clickhouse/tables/test_comments', 'r1') ORDER BY column_name1; -SHOW CREATE test.check_comments; -DESC test.check_comments; +SHOW CREATE check_comments; +DESC check_comments; -ALTER TABLE test.check_comments COMMENT COLUMN column_name1 'another comment'; +ALTER TABLE check_comments COMMENT COLUMN column_name1 'another comment'; -SHOW CREATE test.check_comments; -DESC test.check_comments; +SHOW CREATE check_comments; +DESC check_comments; -SELECT * FROM system.columns WHERE table = 'check.comments' and database = 'test'; +SELECT * FROM system.columns WHERE table = 'check.comments' and database = currentDatabase(); -DROP TABLE test.check_comments; +DROP TABLE check_comments; diff --git a/tests/queries/0_stateless/00800_versatile_storage_join.sql b/tests/queries/0_stateless/00800_versatile_storage_join.sql index 1cde47bcb5e..c1e325ce9aa 100644 --- a/tests/queries/0_stateless/00800_versatile_storage_join.sql +++ b/tests/queries/0_stateless/00800_versatile_storage_join.sql @@ -71,3 +71,5 @@ SELECT joinGet('test_00800.join_test', 'b', 1); USE default; DROP TABLE test_00800.join_test; + +DROP DATABASE test_00800; diff --git a/tests/queries/0_stateless/00980_create_temporary_live_view.sql b/tests/queries/0_stateless/00980_create_temporary_live_view.sql index 062b3f30b69..458ea97991f 100644 --- a/tests/queries/0_stateless/00980_create_temporary_live_view.sql +++ b/tests/queries/0_stateless/00980_create_temporary_live_view.sql @@ -1,16 +1,16 @@ SET allow_experimental_live_view = 1; -DROP TABLE IF EXISTS test.lv; -DROP TABLE IF EXISTS test.mt; +DROP TABLE IF EXISTS lv; +DROP TABLE IF EXISTS mt; SELECT name, value from system.settings WHERE name = 'temporary_live_view_timeout'; SELECT name, value from system.settings WHERE name = 'live_view_heartbeat_interval'; -CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple(); -CREATE LIVE VIEW test.lv WITH TIMEOUT 1 AS SELECT sum(a) FROM test.mt; +CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple(); +CREATE LIVE VIEW lv WITH TIMEOUT 1 AS SELECT sum(a) FROM mt; -SHOW TABLES FROM test LIKE 'lv'; +SHOW TABLES FROM currentDatabase() LIKE 'lv'; SELECT sleep(2); -SHOW TABLES FROM test LIKE 'lv'; +SHOW TABLES FROM currentDatabase() LIKE 'lv'; -DROP TABLE test.mt; +DROP TABLE mt; diff --git a/tests/queries/0_stateless/01078_merge_tree_read_one_thread.sql b/tests/queries/0_stateless/01078_merge_tree_read_one_thread.sql index 41fcbe81709..2d6007c678c 100644 --- a/tests/queries/0_stateless/01078_merge_tree_read_one_thread.sql +++ b/tests/queries/0_stateless/01078_merge_tree_read_one_thread.sql @@ -13,4 +13,6 @@ select sleep(1) format Null; -- sleep a bit to wait possible merges after insert set max_threads = 1; optimize table t final; -select sum(a) from t where a in (0, 3) and b = 0; +select sum(a) from t where a in (0, 3) and b = 0; + +drop table t; diff --git a/tests/queries/0_stateless/01095_tpch_like_smoke.sql b/tests/queries/0_stateless/01095_tpch_like_smoke.sql index 54d5dbd0ba6..ffd2e21dc39 100644 --- a/tests/queries/0_stateless/01095_tpch_like_smoke.sql +++ b/tests/queries/0_stateless/01095_tpch_like_smoke.sql @@ -1,6 +1,3 @@ -CREATE DATABASE IF NOT EXISTS tpch; -USE tpch; - DROP TABLE IF EXISTS part; DROP TABLE IF EXISTS supplier; DROP TABLE IF EXISTS partsupp; @@ -265,7 +262,7 @@ from where l_shipdate >= date '1994-01-01' and l_shipdate < date '1994-01-01' + interval '1' year - and l_discount between toDecimal32(0.06, 2) - toDecimal32(0.01, 2) + and l_discount between toDecimal32(0.06, 2) - toDecimal32(0.01, 2) and toDecimal32(0.06, 2) + toDecimal32(0.01, 2) and l_quantity < 24; @@ -672,7 +669,7 @@ where and l_shipmode in ('AIR', 'AIR REG') and l_shipinstruct = 'DELIVER IN PERSON' ); - + select 20, 'fail: correlated subquery'; -- TODO: Missing columns: 'ps_suppkey' 'ps_partkey' select s_name, diff --git a/tests/queries/conftest.py b/tests/queries/conftest.py index 47e87ed7e10..e0f47f63451 100644 --- a/tests/queries/conftest.py +++ b/tests/queries/conftest.py @@ -24,7 +24,7 @@ def cmdopts(request): def bin_prefix(cmdopts): prefix = 'clickhouse' if cmdopts['builddir'] is not None: - prefix = os.path.join(cmdopts['builddir'], 'dbms', 'programs', prefix) + prefix = os.path.join(cmdopts['builddir'], 'programs', prefix) return prefix diff --git a/tests/queries/query_test.py b/tests/queries/query_test.py index c91765949bf..e31a8ded265 100644 --- a/tests/queries/query_test.py +++ b/tests/queries/query_test.py @@ -57,4 +57,4 @@ def test_query(bin_prefix, sql_query, standalone_server): run_client(bin_prefix, tcp_port, 'DROP DATABASE {random};'.format(random=random_name), '') query = "SELECT 'SHOW ORPHANED DATABASES'; SHOW DATABASES;" - run_client(bin_prefix, tcp_port, query, 'SHOW ORPHANED DATABASES\ndefault\nsystem\n') + run_client(bin_prefix, tcp_port, query, 'SHOW ORPHANED DATABASES\n_temporary_and_external_tables\ndefault\nsystem\n') diff --git a/tests/queries/server.py b/tests/queries/server.py index 185b694619e..de547fffc72 100644 --- a/tests/queries/server.py +++ b/tests/queries/server.py @@ -75,7 +75,9 @@ class ServerThread(threading.Thread): # If process has died then try to fetch output before releasing lock if self._proc.returncode is not None: - self._proc.communicate() + stdout, stderr = self._proc.communicate() + print >> sys.stderr, stdout + print >> sys.stderr, stderr if self._proc.returncode == 70: # Address already in use retries -= 1 @@ -121,7 +123,7 @@ ServerThread.DEFAULT_SERVER_CONFIG = \ users.xml 5368709120 - UTC + Europe/Moscow