From a078a0d602af45666c866bb67d75ce6ca9923d29 Mon Sep 17 00:00:00 2001 From: lsy3993 <110876560+lsy3993@users.noreply.github.com> Date: Wed, 7 Dec 2022 14:41:57 +0800 Subject: [PATCH] [test](catalog)add some emr hive case (#14848) --- .../hive/test_external_catalog_hive.out | 95 ++++++++++++++++++ .../es/test_external_es.groovy | 0 .../hive/test_external_catalog_hive.groovy | 96 +++++++++++++++++++ .../hive/test_external_hive.groovy | 0 .../mysql/test_external_mysql.groovy | 0 .../mysql/test_external_resource_mysql.groovy | 0 .../pg/test_external_pg.groovy | 0 .../hive/test_external_catalog_hive.groovy | 54 ----------- 8 files changed, 191 insertions(+), 54 deletions(-) create mode 100644 regression-test/data/external_table_emr_p2/hive/test_external_catalog_hive.out rename regression-test/suites/{external_table_tecent_emr_p2 => external_table_emr_p2}/es/test_external_es.groovy (100%) create mode 100644 regression-test/suites/external_table_emr_p2/hive/test_external_catalog_hive.groovy rename regression-test/suites/{external_table_tecent_emr_p2 => external_table_emr_p2}/hive/test_external_hive.groovy (100%) rename regression-test/suites/{external_table_tecent_emr_p2 => external_table_emr_p2}/mysql/test_external_mysql.groovy (100%) rename regression-test/suites/{external_table_tecent_emr_p2 => external_table_emr_p2}/mysql/test_external_resource_mysql.groovy (100%) rename regression-test/suites/{external_table_tecent_emr_p2 => external_table_emr_p2}/pg/test_external_pg.groovy (100%) delete mode 100644 regression-test/suites/external_table_tecent_emr_p2/hive/test_external_catalog_hive.groovy diff --git a/regression-test/data/external_table_emr_p2/hive/test_external_catalog_hive.out b/regression-test/data/external_table_emr_p2/hive/test_external_catalog_hive.out new file mode 100644 index 0000000000..b7a66d44d4 --- /dev/null +++ b/regression-test/data/external_table_emr_p2/hive/test_external_catalog_hive.out @@ -0,0 +1,95 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !q01 -- +zhangsan 1 +lisi 1 + +-- !q02 -- +1 1 +2 1 +3 1 +4 1 + +-- !q03 -- +123 china 4 56 sc +234 america 5 67 ls +345 cana 4 56 fy +567 fre 7 89 pa + +-- !q04 -- +p_partkey2 p_name2 p_mfgr2 p_brand2 p_type2 p_size2 p_con2 p_r_price2 p_comment2 +p_partkey1 p_name1 p_mfgr1 p_brand1 p_type1 p_size1 p_con1 p_r_price1 p_comment1 +p_partkey0 p_name0 p_mfgr0 p_brand0 p_type0 p_size0 p_con0 p_r_price0 p_comment0 + +-- !q05 -- +batchno appsheet_no filedate t_no tano t_name chged_no mob_no2 home_no off_no +off_no home_no mob_no2 chged_no t_name tano t_no filedate appsheet_no batchno + +-- !q06 -- +bill_code dates ord_year ord_month ord_quarter on_time + +-- !q07 -- +2 + +-- !q08 -- +123 zhangsan 12 123.45 2022-01-01 +124 lisi 12 123.45 2022-01-01 +125 lisan 12 123.45 2022-01-02 + +-- !q09 -- +a123 12 +a124 13 +a125 14 +a126 15 + +-- !q10 -- +IVhzIApeRb ot,c,E + +-- !q11 -- +16.00 + +-- !q12 -- +25 + +-- !q13 -- +1500000000 + +-- !q14 -- +moccasin steel bisque cornsilk lace + +-- !q15 -- +903.73 + +-- !q16 -- +0 AFRICA lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to +1 AMERICA hs use ironic, even requests. s +2 ASIA ges. thinly even pinto beans ca + +-- !q17 -- +Z6n2t4XA2n7CXTECJ,PE,iBbsCh0RE1Dd2A,z48 + +-- !q18 -- +IVhzIApeRb ot,c,E + +-- !q19 -- +16.00 + +-- !q20 -- +25 + +-- !q21 -- +1500000000 + +-- !q22 -- +moccasin steel bisque cornsilk lace + +-- !q23 -- +903.73 + +-- !q24 -- +0 AFRICA lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to +1 AMERICA hs use ironic, even requests. s +2 ASIA ges. thinly even pinto beans ca + +-- !q25 -- +Z6n2t4XA2n7CXTECJ,PE,iBbsCh0RE1Dd2A,z48 + diff --git a/regression-test/suites/external_table_tecent_emr_p2/es/test_external_es.groovy b/regression-test/suites/external_table_emr_p2/es/test_external_es.groovy similarity index 100% rename from regression-test/suites/external_table_tecent_emr_p2/es/test_external_es.groovy rename to regression-test/suites/external_table_emr_p2/es/test_external_es.groovy diff --git a/regression-test/suites/external_table_emr_p2/hive/test_external_catalog_hive.groovy b/regression-test/suites/external_table_emr_p2/hive/test_external_catalog_hive.groovy new file mode 100644 index 0000000000..7917a1c902 --- /dev/null +++ b/regression-test/suites/external_table_emr_p2/hive/test_external_catalog_hive.groovy @@ -0,0 +1,96 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_external_catalog_hive", "p2") { + + String enabled = context.config.otherConfigs.get("enableExternalHiveTest") + if (enabled != null && enabled.equalsIgnoreCase("true")) { + try { + String extHiveHmsHost = context.config.otherConfigs.get("extHiveHmsHost") + String extHiveHmsPort = context.config.otherConfigs.get("extHiveHmsPort") + String catalog_name = "test_external_catalog_hive" + + sql """admin set frontend config ("enable_multi_catalog" = "true")""" + + sql """drop catalog if exists ${catalog_name};""" + + sql """ + create catalog if not exists ${catalog_name} properties ( + 'type'='hms', + 'hive.metastore.uris' = 'thrift://${extHiveHmsHost}:${extHiveHmsPort}' + ); + """ + + sql """switch ${catalog_name};""" + + sql """use test;""" + + def res = sql """select count(*) from test.hive_test limit 10;""" + logger.info("recoding select: " + res.toString()) + + sql """switch internal""" + + def res1 = sql """show databases;""" + logger.info("recoding select: " + res1.toString()) + + sql """switch ${catalog_name};""" + // test small table(text format) + def q01 = { + qt_q01 """ select name, count(1) as c from student group by name order by c desc;""" + qt_q02 """ select lo_orderkey, count(1) as c from lineorder group by lo_orderkey order by c desc;""" + qt_q03 """ select * from test1 order by col_1;""" + qt_q04 """ select * from string_table order by p_partkey desc;""" + qt_q05 """ select * from account_fund order by batchno;""" + qt_q06 """ select * from sale_table order by bill_code limit 01;""" + qt_q07 """ select count(card_cnt) from hive01;""" + qt_q08 """ select * from test2 order by id;""" + qt_q09 """ select * from test_hive_doris order by id;""" + } + sql """ use `default`; """ + q01() + //test for big table(parquet format) + def q02 = { + qt_q10 """ select c_address from customer where c_custkey = 1 and c_name = 'Customer#000000001'; """ + qt_q11 """ select l_quantity from lineitem where l_orderkey = 599614241 and l_partkey = 59018738 and l_suppkey = 1518744 limit 2 """ + qt_q12 """ select count(1) from nation """ + qt_q13 """ select count(1) from orders """ + qt_q14 """ select p_name from part where p_partkey = 4438130 order by p_name limit 1; """ + qt_q15 """ select ps_supplycost from partsupp where ps_partkey = 199588198 and ps_suppkey = 9588199 and ps_availqty = 2949 """ + qt_q16 """ select * from region order by r_regionkey limit 3 """ + qt_q17 """ select s_address from supplier where s_suppkey = 2823947 limit 3""" + } + sql """ use tpch_1000_parquet; """ + q02() + //test for big table(orc format) + def q03 = { + qt_q18 """ select c_address from customer where c_custkey = 1 and c_name = 'Customer#000000001'; """ + qt_q19 """ select l_quantity from lineitem where l_orderkey = 599614241 and l_partkey = 59018738 and l_suppkey = 1518744 limit 2 """ + qt_q20 """ select count(1) from nation """ + qt_q21 """ select count(1) from orders """ + qt_q22 """ select p_name from part where p_partkey = 4438130 order by p_name limit 1; """ + qt_q23 """ select ps_supplycost from partsupp where ps_partkey = 199588198 and ps_suppkey = 9588199 and ps_availqty = 2949 """ + qt_q24 """ select * from region order by r_regionkey limit 3 """ + qt_q25 """ select s_address from supplier where s_suppkey = 2823947 limit 3""" + } + sql """ use tpch_1000_orc; """ + q03() + + } finally { + // sql """admin set frontend config ("enable_multi_catalog" = "false")""" + } + } +} diff --git a/regression-test/suites/external_table_tecent_emr_p2/hive/test_external_hive.groovy b/regression-test/suites/external_table_emr_p2/hive/test_external_hive.groovy similarity index 100% rename from regression-test/suites/external_table_tecent_emr_p2/hive/test_external_hive.groovy rename to regression-test/suites/external_table_emr_p2/hive/test_external_hive.groovy diff --git a/regression-test/suites/external_table_tecent_emr_p2/mysql/test_external_mysql.groovy b/regression-test/suites/external_table_emr_p2/mysql/test_external_mysql.groovy similarity index 100% rename from regression-test/suites/external_table_tecent_emr_p2/mysql/test_external_mysql.groovy rename to regression-test/suites/external_table_emr_p2/mysql/test_external_mysql.groovy diff --git a/regression-test/suites/external_table_tecent_emr_p2/mysql/test_external_resource_mysql.groovy b/regression-test/suites/external_table_emr_p2/mysql/test_external_resource_mysql.groovy similarity index 100% rename from regression-test/suites/external_table_tecent_emr_p2/mysql/test_external_resource_mysql.groovy rename to regression-test/suites/external_table_emr_p2/mysql/test_external_resource_mysql.groovy diff --git a/regression-test/suites/external_table_tecent_emr_p2/pg/test_external_pg.groovy b/regression-test/suites/external_table_emr_p2/pg/test_external_pg.groovy similarity index 100% rename from regression-test/suites/external_table_tecent_emr_p2/pg/test_external_pg.groovy rename to regression-test/suites/external_table_emr_p2/pg/test_external_pg.groovy diff --git a/regression-test/suites/external_table_tecent_emr_p2/hive/test_external_catalog_hive.groovy b/regression-test/suites/external_table_tecent_emr_p2/hive/test_external_catalog_hive.groovy deleted file mode 100644 index e43bee6f31..0000000000 --- a/regression-test/suites/external_table_tecent_emr_p2/hive/test_external_catalog_hive.groovy +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -suite("test_external_catalog_hive", "p2") { - - String enabled = context.config.otherConfigs.get("enableExternalHiveTest") - if (enabled != null && enabled.equalsIgnoreCase("true")) { - try { - String extHiveHmsHost = context.config.otherConfigs.get("extHiveHmsHost") - String extHiveHmsPort = context.config.otherConfigs.get("extHiveHmsPort") - String catalog_name = "test_external_catalog_hive" - - sql """admin set frontend config ("enable_multi_catalog" = "true")""" - - sql """drop catalog if exists ${catalog_name};""" - - sql """ - create catalog if not exists ${catalog_name} properties ( - 'type'='hms', - 'hive.metastore.uris' = 'thrift://${extHiveHmsHost}:${extHiveHmsPort}' - ); - """ - - sql """switch ${catalog_name};""" - - sql """use test;""" - - def res = sql """select count(*) from test.hive_test limit 10;""" - logger.info("recoding select: " + res.toString()) - - sql """switch internal""" - - def res1 = sql """show databases;""" - logger.info("recoding select: " + res1.toString()) - - } finally { - // sql """admin set frontend config ("enable_multi_catalog" = "false")""" - } - } -}