Merge pull request #33703 from ClickHouse/kssenii-patch-2

Fix hive tests
This commit is contained in:
Kseniia Sumarokova 2022-01-17 22:55:19 +03:00 committed by GitHub
commit 48d736a0c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,7 @@ def test_create_parquet_table(started_cluster):
node = started_cluster.instances['h0_0_0'] node = started_cluster.instances['h0_0_0']
node.query("set input_format_parquet_allow_missing_columns = true") node.query("set input_format_parquet_allow_missing_columns = true")
result = node.query(""" result = node.query("""
DROP TABLE IF EXISTS default.demo_parquet;
CREATE TABLE default.demo_parquet (`id` Nullable(String), `score` Nullable(Int32), `day` Nullable(String)) ENGINE = Hive('thrift://hivetest:9083', 'test', 'demo') PARTITION BY(day) CREATE TABLE default.demo_parquet (`id` Nullable(String), `score` Nullable(Int32), `day` Nullable(String)) ENGINE = Hive('thrift://hivetest:9083', 'test', 'demo') PARTITION BY(day)
""") """)
logging.info("create result {}".format(result)) logging.info("create result {}".format(result))
@ -39,6 +40,7 @@ def test_create_orc_table(started_cluster):
logging.info('Start testing creating hive table ...') logging.info('Start testing creating hive table ...')
node = started_cluster.instances['h0_0_0'] node = started_cluster.instances['h0_0_0']
result = node.query(""" result = node.query("""
DROP TABLE IF EXISTS default.demo_orc;
CREATE TABLE default.demo_orc (`id` Nullable(String), `score` Nullable(Int32), `day` Nullable(String)) ENGINE = Hive('thrift://hivetest:9083', 'test', 'demo_orc') PARTITION BY(day) CREATE TABLE default.demo_orc (`id` Nullable(String), `score` Nullable(Int32), `day` Nullable(String)) ENGINE = Hive('thrift://hivetest:9083', 'test', 'demo_orc') PARTITION BY(day)
""") """)
logging.info("create result {}".format(result)) logging.info("create result {}".format(result))
@ -49,6 +51,7 @@ def test_create_text_table(started_cluster):
logging.info('Start testing creating hive table ...') logging.info('Start testing creating hive table ...')
node = started_cluster.instances['h0_0_0'] node = started_cluster.instances['h0_0_0']
result = node.query(""" result = node.query("""
DROP TABLE IF EXISTS default.demo_text;
CREATE TABLE default.demo_text (`id` Nullable(String), `score` Nullable(Int32), `day` Nullable(String)) ENGINE = Hive('thrift://hivetest:9083', 'test', 'demo_text') PARTITION BY (tuple()) CREATE TABLE default.demo_text (`id` Nullable(String), `score` Nullable(Int32), `day` Nullable(String)) ENGINE = Hive('thrift://hivetest:9083', 'test', 'demo_text') PARTITION BY (tuple())
""") """)
logging.info("create result {}".format(result)) logging.info("create result {}".format(result))
@ -108,7 +111,8 @@ def test_cache_read_bytes(started_cluster):
node = started_cluster.instances['h0_0_0'] node = started_cluster.instances['h0_0_0']
node.query("set input_format_parquet_allow_missing_columns = true") node.query("set input_format_parquet_allow_missing_columns = true")
result = node.query(""" result = node.query("""
CREATE TABLE IF NOT EXISTS default.demo_parquet (`id` Nullable(String), `score` Nullable(Int32), `day` Nullable(String)) ENGINE = Hive('thrift://hivetest:9083', 'test', 'demo') PARTITION BY(day) DROP TABLE IF EXISTS default.demo_parquet;
CREATE TABLE default.demo_parquet (`id` Nullable(String), `score` Nullable(Int32), `day` Nullable(String)) ENGINE = Hive('thrift://hivetest:9083', 'test', 'demo') PARTITION BY(day)
""") """)
result = node.query(""" result = node.query("""
SELECT day, count(*) FROM default.demo_parquet group by day order by day SELECT day, count(*) FROM default.demo_parquet group by day order by day