From 5f81becd843b551c150ac3bdce3de5eb4e96fa88 Mon Sep 17 00:00:00 2001 From: Lenni Kuff Date: Tue, 26 Mar 2013 18:14:16 -0700 Subject: [PATCH] Create tables used by insert tests in a supported insert format --- testdata/bin/generate-schema-statements.py | 11 +++++-- .../queries/QueryTest/distinct.test | 4 +-- .../queries/QueryTest/exprs.test | 22 ++++++------- .../queries/QueryTest/hbase-scan-node.test | 4 +-- .../queries/QueryTest/insert.test | 12 +++---- .../queries/QueryTest/insert_overwrite.test | 16 +++++----- testdata/workloads/tpch/queries/tpch-q11.test | 14 ++++---- testdata/workloads/tpch/queries/tpch-q15.test | 18 +++++------ testdata/workloads/tpch/queries/tpch-q16.test | 16 +++++----- testdata/workloads/tpch/queries/tpch-q17.test | 8 ++--- testdata/workloads/tpch/queries/tpch-q2.test | 18 +++++------ testdata/workloads/tpch/queries/tpch-q20.test | 32 +++++++++---------- testdata/workloads/tpch/queries/tpch-q22.test | 8 ++--- tests/common/impala_test_suite.py | 16 +++++----- 14 files changed, 103 insertions(+), 96 deletions(-) diff --git a/testdata/bin/generate-schema-statements.py b/testdata/bin/generate-schema-statements.py index 53733941d..8322ca925 100755 --- a/testdata/bin/generate-schema-statements.py +++ b/testdata/bin/generate-schema-statements.py @@ -349,6 +349,13 @@ def generate_statements(output_name, test_vectors, sections, db = '{0}{1}'.format(db_name, db_suffix) data_path = os.path.join(options.hive_warehouse_dir, hdfs_location) + # Empty tables (tables with no "LOAD" sections) are assumed to be used for insert + # testing. Since Impala currently only supports inserting into TEXT and PARQUET we + # need to create these tables with a supported insert format. + create_file_format = file_format + if not load_local and not insert: + create_file_format = 'text' if 'file_format' != 'parquet' else 'parquet' + if table_names and (table_name.lower() not in table_names): print 'Skipping table: %s.%s' % (db, table_name) continue @@ -376,7 +383,7 @@ def generate_statements(output_name, test_vectors, sections, assert columns, "No CREATE or COLUMNS section defined for table " + table_name avro_schema_dir = "%s/%s" % (AVRO_SCHEMA_DIR, data_set) table_template = build_table_template( - file_format, columns, partition_columns, row_format, avro_schema_dir) + create_file_format, columns, partition_columns, row_format, avro_schema_dir) # Write Avro schema to local file if not os.path.exists(avro_schema_dir): os.makedirs(avro_schema_dir) @@ -385,7 +392,7 @@ def generate_statements(output_name, test_vectors, sections, output.create.append( build_create_statement(table_template, table_name, db_name, db_suffix, - file_format, codec, hdfs_location)) + create_file_format, codec, hdfs_location)) # The ALTER statement in hive does not accept fully qualified table names. # We need the use statement. diff --git a/testdata/workloads/functional-query/queries/QueryTest/distinct.test b/testdata/workloads/functional-query/queries/QueryTest/distinct.test index ad1ffd6db..8b28b762d 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/distinct.test +++ b/testdata/workloads/functional-query/queries/QueryTest/distinct.test @@ -141,7 +141,7 @@ NULL,10,450,900,10,1089 ==== ---- QUERY # count distinct order by the same agg expr -select count(distinct id) as count_id from functional.alltypessmall order by count_id limit 100 +select count(distinct id) as count_id from alltypessmall order by count_id limit 100 ---- TYPES bigint ---- RESULTS @@ -149,7 +149,7 @@ bigint ==== ---- QUERY # count distinct order by a diff agg expr -select count(distinct id) as sum_id from functional.alltypessmall order by max(distinct id) +select count(distinct id) as sum_id from alltypessmall order by max(distinct id) limit 100 ---- TYPES bigint diff --git a/testdata/workloads/functional-query/queries/QueryTest/exprs.test b/testdata/workloads/functional-query/queries/QueryTest/exprs.test index 966fdfe4d..676d11f7e 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/exprs.test +++ b/testdata/workloads/functional-query/queries/QueryTest/exprs.test @@ -360,7 +360,7 @@ bigint #891,891,890109,890109,8892188910,8892188910,9771626610293.455,9771626610293.455,9.859473533519994e+16,9.859473533519994e+16 #==== # LIKE exprs w/ the like/regex pattern coming from a column -select * from functional.LikeTbl +select * from LikeTbl ---- TYPES string, string, string, string, string ---- RESULTS @@ -381,7 +381,7 @@ string, string, string, string, string 'two','%two%','n%two%','.*two.*','n.*two.*' ==== ---- QUERY -select str_col, match_like_col from functional.LikeTbl +select str_col, match_like_col from LikeTbl where str_col LIKE match_like_col ---- TYPES string, string @@ -402,14 +402,14 @@ string, string '','%' ==== ---- QUERY -select str_col, match_like_col from functional.LikeTbl +select str_col, match_like_col from LikeTbl where str_col NOT LIKE match_like_col ---- TYPES string, string ---- RESULTS ==== ---- QUERY -select str_col, match_like_col from functional.LikeTbl +select str_col, match_like_col from LikeTbl where str_col LIKE no_match_like_col ---- TYPES string, string @@ -417,7 +417,7 @@ string, string '','%' ==== ---- QUERY -select str_col, no_match_like_col from functional.LikeTbl +select str_col, no_match_like_col from LikeTbl where str_col NOT LIKE no_match_like_col ---- TYPES string, string @@ -437,7 +437,7 @@ string, string 'two','n%two%' ==== ---- QUERY -select str_col, match_regex_col from functional.LikeTbl +select str_col, match_regex_col from LikeTbl where str_col REGEXP match_regex_col ---- TYPES string, string @@ -458,21 +458,21 @@ string, string '','.*' ==== ---- QUERY -select str_col, no_match_regex_col from functional.LikeTbl +select str_col, no_match_regex_col from LikeTbl where str_col REGEXP no_match_regex_col ---- TYPES string, string ---- RESULTS ==== ---- QUERY -select str_col, match_regex_col from functional.LikeTbl +select str_col, match_regex_col from LikeTbl where str_col NOT REGEXP match_regex_col ---- TYPES string, string ---- RESULTS ==== ---- QUERY -select str_col, no_match_regex_col from functional.LikeTbl +select str_col, no_match_regex_col from LikeTbl where str_col NOT REGEXP no_match_regex_col ---- TYPES string, string @@ -913,7 +913,7 @@ timestamp, timestamp, timestamp, timestamp regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1 ==== ---- QUERY -select now(), now(), now(), now() from functional.alltypestiny +select now(), now(), now(), now() from alltypestiny ---- TYPES timestamp, timestamp, timestamp, timestamp ---- RESULTS @@ -930,7 +930,7 @@ regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1 ---- QUERY # Check that now() returns the same value when evaluated on different nodes # (alltypessmall is partitioned) -select min(now()), max(now()) from functional.alltypessmall +select min(now()), max(now()) from alltypessmall ---- TYPES timestamp, timestamp ---- RESULTS diff --git a/testdata/workloads/functional-query/queries/QueryTest/hbase-scan-node.test b/testdata/workloads/functional-query/queries/QueryTest/hbase-scan-node.test index 6d08a03ef..a0918c0da 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/hbase-scan-node.test +++ b/testdata/workloads/functional-query/queries/QueryTest/hbase-scan-node.test @@ -330,7 +330,7 @@ bigint ==== ---- QUERY # show that the hdfs table has identical results -select count(*) from functional.alltypesagg where smallint_col is null and string_col is not null +select count(*) from alltypesagg where smallint_col is null and string_col is not null ---- TYPES bigint ---- RESULTS @@ -348,7 +348,7 @@ bigint ==== ---- QUERY # Compare this hdfs-equivalent query with the above one. -select count(*) from functional.alltypesagg where smallint_col is null +select count(*) from alltypesagg where smallint_col is null ---- TYPES bigint ---- RESULTS diff --git a/testdata/workloads/functional-query/queries/QueryTest/insert.test b/testdata/workloads/functional-query/queries/QueryTest/insert.test index a91255308..584572065 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/insert.test +++ b/testdata/workloads/functional-query/queries/QueryTest/insert.test @@ -72,7 +72,7 @@ insert overwrite table alltypesinsert partition (year=2009, month=4) select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col -from functional.alltypessmall +from alltypessmall where year=2009 and month=4 ---- SETUP DROP PARTITIONS alltypesinsert @@ -121,7 +121,7 @@ insert into table alltypesinsert partition (year=2009, month=4) select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col -from functional.alltypessmall +from alltypessmall where year=2009 and month=4 ---- SETUP DROP PARTITIONS alltypesinsert @@ -143,7 +143,7 @@ insert overwrite table alltypesinsert partition (year=2009, month) select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, month -from functional.alltypessmall +from alltypessmall where year=2009 and month>1 and month<=4 ---- SETUP DROP PARTITIONS alltypesinsert @@ -243,7 +243,7 @@ insert into table alltypesinsert partition (year=2009, month) select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, month -from functional.alltypessmall +from alltypessmall where year=2009 and month>=1 and month<4 ---- SETUP DROP PARTITIONS alltypesinsert @@ -267,7 +267,7 @@ insert overwrite table alltypesinsert partition (year, month) select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month -from functional.alltypessmall +from alltypessmall ---- SETUP DROP PARTITIONS alltypesinsert ---- RESULTS @@ -392,7 +392,7 @@ insert into table alltypesinsert partition (year, month) select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col, year, month -from functional.alltypessmall +from alltypessmall ---- SETUP DROP PARTITIONS alltypesinsert ---- RESULTS diff --git a/testdata/workloads/functional-query/queries/QueryTest/insert_overwrite.test b/testdata/workloads/functional-query/queries/QueryTest/insert_overwrite.test index 19d9cfdde..42f57c391 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/insert_overwrite.test +++ b/testdata/workloads/functional-query/queries/QueryTest/insert_overwrite.test @@ -3,7 +3,7 @@ # insert overwrite into unpartitioned table insert overwrite table insert_overwrite_nopart select int_col -from functional.tinyinttable +from tinyinttable ---- SETUP RESET insert_overwrite_nopart ---- RESULTS @@ -33,7 +33,7 @@ int # Now do an overwrite that should delete what was just written insert overwrite table insert_overwrite_nopart select 10 -from functional.tinyinttable +from tinyinttable ---- RESULTS : 10 ==== @@ -61,7 +61,7 @@ int # TODO: IMP-240 - Hive will delete data even for inserts that write nothing. When we fix IMP-240, this test should fail. insert overwrite table insert_overwrite_nopart select 3 -from functional.tinyinttable +from tinyinttable limit 0 ---- RESULTS ==== @@ -77,7 +77,7 @@ bigint insert overwrite table insert_overwrite_partitioned PARTITION(col2=5) select int_col -from functional.tinyinttable +from tinyinttable ---- SETUP RESET insert_overwrite_partitioned ---- RESULTS @@ -107,7 +107,7 @@ int,int insert overwrite table insert_overwrite_partitioned PARTITION(col2=6) select int_col -from functional.tinyinttable +from tinyinttable ---- SETUP RESET insert_overwrite_nopart ---- RESULTS @@ -147,7 +147,7 @@ int,int # Overwrite one partition, check that the other partition remains intact insert overwrite table insert_overwrite_partitioned partition(col2=5) -select 10 from functional.tinyinttable +select 10 from tinyinttable ---- RESULTS col2=5/: 10 ==== @@ -184,7 +184,7 @@ int,int insert overwrite table insert_overwrite_partitioned partition(col2) select int_col, int_col -from functional.tinyinttable +from tinyinttable ---- SETUP DROP PARTITIONS insert_overwrite_partitioned ---- RESULTS @@ -223,7 +223,7 @@ int,int # Overwrite dynamic partition. Limit to 1 row without actually using limit, which forces non-parallel insert insert overwrite table insert_overwrite_partitioned partition(col2) -select 10, 0 from functional.tinyinttable +select 10, 0 from tinyinttable where int_col = 0 ---- RESULTS col2=0/: 1 diff --git a/testdata/workloads/tpch/queries/tpch-q11.test b/testdata/workloads/tpch/queries/tpch-q11.test index 553edf92c..92b737275 100644 --- a/testdata/workloads/tpch/queries/tpch-q11.test +++ b/testdata/workloads/tpch/queries/tpch-q11.test @@ -2,7 +2,7 @@ ---- QUERY : TPCH-Q11_QUERY_1 # Q11 - Important Stock Identification # TODO: Need to add part 2 of this query. It required some more advanced modifications. -insert overwrite table tpch.q11_part_tmp +insert overwrite table q11_part_tmp select ps_partkey, sum(ps_supplycost * ps_availqty) as part_value from nation n join supplier s @@ -11,18 +11,18 @@ join partsupp ps on ps.ps_suppkey = s.s_suppkey group by ps_partkey ---- SETUP -RESET tpch.q11_sum_tmp -RELOAD tpch.q11_sum_tmp +RESET q11_sum_tmp +RELOAD q11_sum_tmp ---- RESULTS : 29818 ==== ---- QUERY : TPCH-Q11_QUERY_2 -insert overwrite table tpch.q11_sum_tmp +insert overwrite table q11_sum_tmp select sum(part_value) as total_value -from tpch.q11_part_tmp +from q11_part_tmp ---- SETUP -RESET tpch.q11_part_tmp -RELOAD tpch.q11_part_tmp +RESET q11_part_tmp +RELOAD q11_part_tmp ---- RESULTS : 1 ==== diff --git a/testdata/workloads/tpch/queries/tpch-q15.test b/testdata/workloads/tpch/queries/tpch-q15.test index 7210f2f85..3be1cd846 100644 --- a/testdata/workloads/tpch/queries/tpch-q15.test +++ b/testdata/workloads/tpch/queries/tpch-q15.test @@ -1,7 +1,7 @@ ==== ---- QUERY : TPCH-Q15_QUERY_1 # Q15 - Top Supplier Query -insert overwrite table tpch.revenue +insert overwrite table revenue select l_suppkey as supplier_no, sum(l_extendedprice * (1 - l_discount)) as total_revenue @@ -9,18 +9,18 @@ from lineitem where l_shipdate >= '1996-01-01' and l_shipdate < '1996-04-01' group by l_suppkey ---- SETUP -RESET tpch.revenue -RELOAD tpch.revenue +RESET revenue +RELOAD revenue ---- RESULTS : 10000 ==== ---- QUERY : TPCH-Q15_QUERY_2 -insert overwrite table tpch.max_revenue +insert overwrite table max_revenue select max(total_revenue) -from tpch.revenue +from revenue ---- SETUP -RESET tpch.max_revenue -RELOAD tpch.max_revenue +RESET max_revenue +RELOAD max_revenue ---- RESULTS : 1 ==== @@ -33,9 +33,9 @@ select s_phone, total_revenue from supplier s -join tpch.revenue r +join revenue r on (s.s_suppkey = r.supplier_no) -join tpch.max_revenue m +join max_revenue m on (r.total_revenue = m.max_revenue) order by s_suppkey limit 100 diff --git a/testdata/workloads/tpch/queries/tpch-q16.test b/testdata/workloads/tpch/queries/tpch-q16.test index 51dd75e5d..103beb4c1 100644 --- a/testdata/workloads/tpch/queries/tpch-q16.test +++ b/testdata/workloads/tpch/queries/tpch-q16.test @@ -1,29 +1,29 @@ ==== ---- QUERY : TPCH-Q16_QUERY_1 # Q16 - Parts/Supplier Relation Query -insert overwrite table tpch.supplier_tmp +insert overwrite table supplier_tmp select s_suppkey from supplier where not s_comment like '%Customer%Complaints%' ---- SETUP -RESET tpch.supplier_tmp -RELOAD tpch.supplier_tmp +RESET supplier_tmp +RELOAD supplier_tmp ---- RESULTS : 9996 ==== ---- QUERY : TPCH-Q16_QUERY_2 -insert overwrite table tpch.q16_tmp +insert overwrite table q16_tmp select p_brand, p_type, p_size, ps_suppkey from partsupp ps join part p on p.p_partkey = ps.ps_partkey and p.p_brand <> 'Brand#45' and not p.p_type like 'MEDIUM POLISHED%' -join tpch.supplier_tmp s +join supplier_tmp s on ps.ps_suppkey = s.s_suppkey ---- SETUP -RESET tpch.q16_tmp -RELOAD tpch.q16_tmp +RESET q16_tmp +RELOAD q16_tmp ---- RESULTS : 741971 ==== @@ -31,7 +31,7 @@ RELOAD tpch.q16_tmp # Modifications: Added limit select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt from -( select * from tpch.q16_tmp +( select * from q16_tmp where p_size = 49 or p_size = 14 or p_size = 23 or p_size = 45 or p_size = 19 or p_size = 3 or diff --git a/testdata/workloads/tpch/queries/tpch-q17.test b/testdata/workloads/tpch/queries/tpch-q17.test index b6280e0bd..9a781a014 100644 --- a/testdata/workloads/tpch/queries/tpch-q17.test +++ b/testdata/workloads/tpch/queries/tpch-q17.test @@ -1,13 +1,13 @@ ==== ---- QUERY : TPCH-Q17_QUERY_1 # Q17 - Small-Quantity-Order Revenue Query -insert overwrite table tpch.lineitem_tmp +insert overwrite table lineitem_tmp select l_partkey as t_partkey, 0.2 * avg(l_quantity) as t_avg_quantity from lineitem group by l_partkey ---- SETUP -RESET tpch.lineitem_tmp -RELOAD tpch.lineitem_tmp +RESET lineitem_tmp +RELOAD lineitem_tmp ---- RESULTS : 200000 ==== @@ -18,7 +18,7 @@ select round(sum(l_extendedprice) / 7.0, 5) as avg_yearly from lineitem l join part p on (p.p_partkey = l.l_partkey) - join tpch.lineitem_tmp lt + join lineitem_tmp lt on (lt.t_partkey = p.p_partkey) where p.p_brand = 'Brand#23' and diff --git a/testdata/workloads/tpch/queries/tpch-q2.test b/testdata/workloads/tpch/queries/tpch-q2.test index 982001430..4a9b8293b 100644 --- a/testdata/workloads/tpch/queries/tpch-q2.test +++ b/testdata/workloads/tpch/queries/tpch-q2.test @@ -1,7 +1,7 @@ ==== ---- QUERY : TPCH-Q2_QUERY_1 # Q2 - Minimum Cost Supplier Query -insert overwrite table tpch.q2_minimum_cost_supplier_tmp1 +insert overwrite table q2_minimum_cost_supplier_tmp1 select s.s_acctbal, s.s_name, @@ -22,21 +22,21 @@ from partsupp ps join region r on (n.n_regionkey = r.r_regionkey and r.r_name = 'EUROPE') ---- SETUP -RESET tpch.q2_minimum_cost_supplier_tmp1 -RELOAD tpch.q2_minimum_cost_supplier_tmp1 +RESET q2_minimum_cost_supplier_tmp1 +RELOAD q2_minimum_cost_supplier_tmp1 ---- RESULTS : 642 ==== ---- QUERY : TPCH-Q2_QUERY_2 -insert overwrite table tpch.q2_minimum_cost_supplier_tmp2 +insert overwrite table q2_minimum_cost_supplier_tmp2 select p_partkey, min(ps_supplycost) -from tpch.q2_minimum_cost_supplier_tmp1 +from q2_minimum_cost_supplier_tmp1 group by p_partkey ---- SETUP -RESET tpch.q2_minimum_cost_supplier_tmp2 -RELOAD tpch.q2_minimum_cost_supplier_tmp2 +RESET q2_minimum_cost_supplier_tmp2 +RELOAD q2_minimum_cost_supplier_tmp2 ---- RESULTS : 460 ==== @@ -51,8 +51,8 @@ select t1.s_address, t1.s_phone, t1.s_comment -from tpch.q2_minimum_cost_supplier_tmp1 t1 -join tpch.q2_minimum_cost_supplier_tmp2 t2 +from q2_minimum_cost_supplier_tmp1 t1 +join q2_minimum_cost_supplier_tmp2 t2 on (t1.p_partkey = t2.p_partkey and t1.ps_supplycost = t2.ps_min_supplycost) order by s_acctbal desc, diff --git a/testdata/workloads/tpch/queries/tpch-q20.test b/testdata/workloads/tpch/queries/tpch-q20.test index 92c9b3cad..88bcb4214 100644 --- a/testdata/workloads/tpch/queries/tpch-q20.test +++ b/testdata/workloads/tpch/queries/tpch-q20.test @@ -1,18 +1,18 @@ ==== ---- QUERY : TPCH-Q20_QUERY_1 # Q20 - Potential Part Promotion Query -insert overwrite table tpch.q20_tmp1 +insert overwrite table q20_tmp1 select distinct p_partkey from part where p_name like 'forest%' ---- SETUP -RESET tpch.q20_tmp1 -RELOAD tpch.q20_tmp1 +RESET q20_tmp1 +RELOAD q20_tmp1 ---- RESULTS : 2127 ==== ---- QUERY : TPCH-Q20_QUERY_2 -insert overwrite table tpch.q20_tmp2 +insert overwrite table q20_tmp2 select l_partkey, l_suppkey, @@ -25,38 +25,38 @@ group by l_partkey, l_suppkey ---- SETUP -RESET tpch.q20_tmp2 -RELOAD tpch.q20_tmp2 +RESET q20_tmp2 +RELOAD q20_tmp2 ---- RESULTS : 543210 ==== ---- QUERY : TPCH-Q20_QUERY_3 -insert overwrite table tpch.q20_tmp3 +insert overwrite table q20_tmp3 select ps_suppkey, ps_availqty, sum_quantity from partsupp ps - join tpch.q20_tmp2 t2 + join q20_tmp2 t2 on (ps.ps_partkey = t2.l_partkey and ps.ps_suppkey = t2.l_suppkey) - join tpch.q20_tmp1 t1 + join q20_tmp1 t1 on (ps.ps_partkey = t1.p_partkey) ---- SETUP -RESET tpch.q20_tmp3 -RELOAD tpch.q20_tmp3 +RESET q20_tmp3 +RELOAD q20_tmp3 ---- RESULTS : 5843 ==== ---- QUERY : TPCH-Q20_QUERY_4 # Modified to use subquery to work around IMP-127 -insert overwrite table tpch.q20_tmp4 +insert overwrite table q20_tmp4 select ps_suppkey -from tpch.q20_tmp3 +from q20_tmp3 where ps_availqty > sum_quantity group by ps_suppkey ---- SETUP -RESET tpch.q20_tmp4 -RELOAD tpch.q20_tmp4 +RESET q20_tmp4 +RELOAD q20_tmp4 ---- RESULTS : 4397 ==== @@ -69,7 +69,7 @@ from supplier s join nation n on (s.s_nationkey = n.n_nationkey and n.n_name = 'CANADA') -join tpch.q20_tmp4 t4 +join q20_tmp4 t4 on (s.s_suppkey = t4.ps_suppkey) order by s_name diff --git a/testdata/workloads/tpch/queries/tpch-q22.test b/testdata/workloads/tpch/queries/tpch-q22.test index e994823cf..7466cba94 100644 --- a/testdata/workloads/tpch/queries/tpch-q22.test +++ b/testdata/workloads/tpch/queries/tpch-q22.test @@ -5,7 +5,7 @@ # a constant value ('C') so that we can do a join between this table # in the main query. This was needed because we only support equi-joins # and had to have a column to join on. -insert overwrite table tpch.q22_customer_tmp1 +insert overwrite table q22_customer_tmp1 select avg(c_acctbal) avg_acctbal, substr(c_name, 1, 1) as cust_name_char @@ -22,8 +22,8 @@ where group by substr(c_name, 1, 1) ---- SETUP -RESET tpch.q22_customer_tmp1 -RELOAD tpch.q22_customer_tmp1 +RESET q22_customer_tmp1 +RELOAD q22_customer_tmp1 ---- RESULTS : 1 ==== @@ -37,7 +37,7 @@ select count(*) as numcust, round(sum(c_acctbal), 4) as totacctbal from customer c - join tpch.q22_customer_tmp1 ct + join q22_customer_tmp1 ct on (substr(c.c_name, 1, 1) = ct.cust_name_char) left outer join orders o on (o.o_custkey = c.c_custkey) diff --git a/tests/common/impala_test_suite.py b/tests/common/impala_test_suite.py index 39cba5e54..5744965e0 100644 --- a/tests/common/impala_test_suite.py +++ b/tests/common/impala_test_suite.py @@ -124,7 +124,7 @@ class ImpalaTestSuite(BaseTestSuite): output_file = os.path.join('/tmp', test_file_name.replace('/','_') + ".test") write_test_file(output_file, updated_sections) - def execute_test_case_setup(self, setup_section, vector): + def execute_test_case_setup(self, setup_section, table_format): """ Executes a test case 'SETUP' section @@ -135,15 +135,15 @@ class ImpalaTestSuite(BaseTestSuite): DROP PARTITIONS - Drop all partitions from the table RELOAD - Reload the catalog """ - setup_section = QueryTestSectionReader.build_query(setup_section, vector, '') + setup_section = QueryTestSectionReader.build_query(setup_section, table_format, '') for row in setup_section.split('\n'): row = row.lstrip() if row.startswith('RESET'): table_name = row.split('RESET')[1] - self.__reset_table(table_name.strip(), vector) + self.__reset_table(table_name.strip(), table_format) elif row.startswith('DROP PARTITIONS'): table_name = row.split('DROP PARTITIONS')[1] - self.__drop_partitions(table_name.strip(), vector) + self.__drop_partitions(table_name.strip(), table_format) elif row.startswith('RELOAD'): self.client.refresh() else: @@ -198,9 +198,9 @@ class ImpalaTestSuite(BaseTestSuite): assert len(result.data) <= 1, 'Multiple values returned from scalar' return result.data[0] if len(result.data) == 1 else None - def __drop_partitions(self, table_name, vector): + def __drop_partitions(self, table_name, table_format): """Drops all partitions in the given table""" - db_name, table_name = ImpalaTestSuite.__get_db_from_table_name(table_name, vector) + db_name = QueryTestSectionReader.get_db_name(table_format) for partition in self.hive_client.get_partition_names(db_name, table_name, 0): self.hive_client.drop_partition_by_name(db_name, table_name, partition, True) @@ -227,9 +227,9 @@ class ImpalaTestSuite(BaseTestSuite): assert False, 'Test file not found: %s' % file_name return parse_query_test_file(test_file_path) - def __reset_table(self, table_name, vector): + def __reset_table(self, table_name, table_format): """Resets a table (drops and recreates the table)""" - db_name, table_name = ImpalaTestSuite.__get_db_from_table_name(table_name, vector) + db_name = QueryTestSectionReader.get_db_name(table_format) table = self.hive_client.get_table(db_name, table_name) assert table is not None self.hive_client.drop_table(db_name, table_name, True)