From 7ffcfabebd5493439088ec8b7cba529b89fb7d21 Mon Sep 17 00:00:00 2001 From: zhangguoqiang <18372634969@163.com> Date: Thu, 5 Jan 2023 16:50:49 +0800 Subject: [PATCH 1/2] add external table p2 regression cases according doris1.2 docs 20230105 --- .../es/test_external_catalog_es.groovy | 60 ++++++++++ .../es/test_external_es.groovy | 6 +- .../hive/test_external_brown.groovy | 1 + .../hive/test_external_catalog_hive.groovy | 1 + .../hive/test_external_github.groovy | 1 + .../hive/test_external_hive.groovy | 1 + .../hive/test_external_yandex.groovy | 1 + .../mysql/test_external_catalog_mysql.groovy | 103 +++++++++++++++++ .../mysql/test_external_mysql.groovy | 70 ------------ .../mysql/test_external_resource_mysql.groovy | 107 +++++++++++++++--- .../pg/test_external_pg.groovy | 88 ++++++++++++-- 11 files changed, 343 insertions(+), 96 deletions(-) create mode 100644 regression-test/suites/external_table_emr_p2/es/test_external_catalog_es.groovy create mode 100644 regression-test/suites/external_table_emr_p2/mysql/test_external_catalog_mysql.groovy delete mode 100644 regression-test/suites/external_table_emr_p2/mysql/test_external_mysql.groovy diff --git a/regression-test/suites/external_table_emr_p2/es/test_external_catalog_es.groovy b/regression-test/suites/external_table_emr_p2/es/test_external_catalog_es.groovy new file mode 100644 index 00000000000000..bd496ae3013f63 --- /dev/null +++ b/regression-test/suites/external_table_emr_p2/es/test_external_catalog_es.groovy @@ -0,0 +1,60 @@ +package suites.external_table_emr_p2.es +// 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. +//import org.postgresql.Driver +suite("test_external_catalog_es", "p2") { + + String enabled = context.config.otherConfigs.get("enableExternalEsTest") + if (enabled != null && enabled.equalsIgnoreCase("true")) { + String extEsHost = context.config.otherConfigs.get("extEsHost") + String extEsPort = context.config.otherConfigs.get("extEsPort") + String extEsUser = context.config.otherConfigs.get("extEsUser") + String extEsPassword = context.config.otherConfigs.get("extEsPassword") + String esCatalogName ="es7_catalog_name" + + String jdbcPg14Database1 = "jdbc_es_14_database1" + String jdbcPg14Table1 = "accounts" + + sql """drop catalog if exists ${esCatalogName}""" + + sql """ + CREATE CATALOG ${esCatalogName} PROPERTIES ( + "type"="es", + "elasticsearch.hosts"="http://${extEsHost}:${extEsPort}", + "elasticsearch.nodes_discovery"="false", + "elasticsearch.username"="${extEsUser}", + "elasticsearch.username"="${extEsPassword}", + ); + """ + + sql """ + SWITCH ${esCatalogName}; + """ + sql """ + SHOW DATABASES; + """ + + def res1=sql "select * from ${jdbcPg14Table1} limit 10;" + logger.info("recoding all: " + res1.toString()) + + sql """drop table if exists ${jdbcPg14Table1};""" + sql """drop database if exists ${jdbcPg14Database1};""" + + sql """switch internal;""" + + } +} diff --git a/regression-test/suites/external_table_emr_p2/es/test_external_es.groovy b/regression-test/suites/external_table_emr_p2/es/test_external_es.groovy index 323a35da3ca148..9be1bb66a3cdb7 100644 --- a/regression-test/suites/external_table_emr_p2/es/test_external_es.groovy +++ b/regression-test/suites/external_table_emr_p2/es/test_external_es.groovy @@ -1,3 +1,4 @@ +package suites.external_table_emr_p2.es // 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 @@ -38,11 +39,10 @@ suite("test_external_es", "p2") { `age` varchar(20) COMMENT "" ) ENGINE=ELASTICSEARCH PROPERTIES ( - "hosts" = "https://${extEsHost}:${extEsPort}", + "hosts" = "http://${extEsHost}:${extEsPort}", "index" = "helloworld", "user" = "${extEsUser}", - "password" = "${extEsPassword}", - "http_ssl_enabled" = "true" + "password" = "${extEsPassword}" ); """ def res=sql """show create table ${jdbcPg14Table1};""" diff --git a/regression-test/suites/external_table_emr_p2/hive/test_external_brown.groovy b/regression-test/suites/external_table_emr_p2/hive/test_external_brown.groovy index 8ba09f0596308c..1d0f1d2629e337 100644 --- a/regression-test/suites/external_table_emr_p2/hive/test_external_brown.groovy +++ b/regression-test/suites/external_table_emr_p2/hive/test_external_brown.groovy @@ -1,3 +1,4 @@ +package suites.external_table_emr_p2.hive // 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 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 index ba25807c51947c..b329ed048831d7 100644 --- 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 @@ -1,3 +1,4 @@ +package suites.external_table_emr_p2.hive // 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 diff --git a/regression-test/suites/external_table_emr_p2/hive/test_external_github.groovy b/regression-test/suites/external_table_emr_p2/hive/test_external_github.groovy index 1dd52173b6622c..43f76762bc40dc 100644 --- a/regression-test/suites/external_table_emr_p2/hive/test_external_github.groovy +++ b/regression-test/suites/external_table_emr_p2/hive/test_external_github.groovy @@ -1,3 +1,4 @@ +package suites.external_table_emr_p2.hive // 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 diff --git a/regression-test/suites/external_table_emr_p2/hive/test_external_hive.groovy b/regression-test/suites/external_table_emr_p2/hive/test_external_hive.groovy index 9ac49a0aa4dbe8..79d51376fcb1be 100644 --- a/regression-test/suites/external_table_emr_p2/hive/test_external_hive.groovy +++ b/regression-test/suites/external_table_emr_p2/hive/test_external_hive.groovy @@ -1,3 +1,4 @@ +package suites.external_table_emr_p2.hive // 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 diff --git a/regression-test/suites/external_table_emr_p2/hive/test_external_yandex.groovy b/regression-test/suites/external_table_emr_p2/hive/test_external_yandex.groovy index b99524774831f6..83e8f9e6c3d904 100644 --- a/regression-test/suites/external_table_emr_p2/hive/test_external_yandex.groovy +++ b/regression-test/suites/external_table_emr_p2/hive/test_external_yandex.groovy @@ -1,3 +1,4 @@ +package suites.external_table_emr_p2.hive // 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 diff --git a/regression-test/suites/external_table_emr_p2/mysql/test_external_catalog_mysql.groovy b/regression-test/suites/external_table_emr_p2/mysql/test_external_catalog_mysql.groovy new file mode 100644 index 00000000000000..422f26e91d7fff --- /dev/null +++ b/regression-test/suites/external_table_emr_p2/mysql/test_external_catalog_mysql.groovy @@ -0,0 +1,103 @@ +package suites.external_table_emr_p2.mysql +// 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. +//import com.mysql.cj.jdbc.Driver +suite("test_external_catalog_mysql", "p2") { + + String enabled = context.config.otherConfigs.get("enableExternalMysqlTest") + if (enabled != null && enabled.equalsIgnoreCase("true")) { + String extMysqlHost = context.config.otherConfigs.get("extMysqlHost") + String extMysqlPort = context.config.otherConfigs.get("extMysqlPort") + String extMysqlUser = context.config.otherConfigs.get("extMysqlUser") + String extMysqlPassword = context.config.otherConfigs.get("extMysqlPassword") + String mysqlDatabaseName01 = "external_mysql_catalog_database01" + String mysqlResource01 = "mysql_catalog_resource_01" + String mysqlCatalogName = "mysql_jdbc" + String mysqlTableName01 = "lineorder" + String mysqlTableName02 = "customer" + String mysqlTableName03 = "supplier" + + sql """drop database if exists ${mysqlDatabaseName01};""" + sql """create database ${mysqlDatabaseName01};""" + sql """use ${mysqlDatabaseName01};""" + + + sql """drop resource if exists ${mysqlResource01};""" + sql """ + CREATE RESOURCE ${mysqlResource01} + properties ( + "type"="jdbc", + "user"="${extMysqlUser}", + "password"="${extMysqlPassword}", + "jdbc_url"="jdbc:mysql://${extMysqlHost}:${extMysqlPort}/ssb?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false", + "driver_url"="https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/jdbc_driver/mysql-connector-java-8.0.25.jar", + "driver_class"="com.mysql.cj.jdbc.Driver" + ); + """ + + sql """drop catalog if exists ${mysqlCatalogName};""" + + sql """CREATE CATALOG ${mysqlCatalogName} WITH RESOURCE ${mysqlResource01};""" +// sql """drop catalog if exists ${mysqlCatalogName};""" + + +// sql """ +// CREATE CATALOG ${mysqlCatalogName} +// PROPERTIES( +// "type"="jdbc", +// "jdbc.user"="${extMysqlUser}", +// "jdbc.password"="${extMysqlPassword}", +// "jdbc.jdbc_url"="jdbc:mysql://${extMysqlHost}:${extMysqlPort}/ssb?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false", +// "jdbc.driver_url"="https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/jdbc_driver/mysql-connector-java-8.0.25.jar", +// "jdbc.driver_class"="com.mysql.cj.jdbc.Driver" +// ); +// """ + + sql """switch ${mysqlCatalogName}""" + + sql """use ssb;""" + + + def res = sql """select count(*) from ${mysqlTableName02};""" + logger.info("recoding select: " + res.toString()) + + + def res1 = sql """select count(*) from ${mysqlTableName03};""" + logger.info("recoding select: " + res1.toString()) + + def res2 = sql """select * from ${mysqlTableName02} limit 10;""" + logger.info("recoding select: " + res2.toString()) + + def res3 = sql """select * from ${mysqlTableName03} limit 10;""" + logger.info("recoding select: " + res3.toString()) + + def res4 = sql """select * from ${mysqlTableName02} a join ${mysqlTableName03} b on a.c_nation =b.s_nation limit 5;""" + logger.info("recoding select: " + res4.toString()) + + +// sql """drop table if exists ${mysqlTableName01}""" + sql """drop database if exists ${mysqlDatabaseName01};""" + sql """switch internal;""" + } +} + + + + + + + diff --git a/regression-test/suites/external_table_emr_p2/mysql/test_external_mysql.groovy b/regression-test/suites/external_table_emr_p2/mysql/test_external_mysql.groovy deleted file mode 100644 index 4f366a1c99b20f..00000000000000 --- a/regression-test/suites/external_table_emr_p2/mysql/test_external_mysql.groovy +++ /dev/null @@ -1,70 +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. -//import com.mysql.cj.jdbc.Driver -suite("test_external_mysql", "p2") { - - String enabled = context.config.otherConfigs.get("enableExternalMysqlTest") - if (enabled != null && enabled.equalsIgnoreCase("true")) { - String extMysqlHost = context.config.otherConfigs.get("extMysqlHost") - String extMysqlPort = context.config.otherConfigs.get("extMysqlPort") - String extMysqlUser = context.config.otherConfigs.get("extMysqlUser") - String extMysqlPassword = context.config.otherConfigs.get("extMysqlPassword") - String mysqlDatabaseName01 = "external_mysql_database01" - String mysqlTableName01 = "external_mysql_table01" - - sql """drop database if exists ${mysqlDatabaseName01};""" - sql """create database ${mysqlDatabaseName01};""" - sql """use ${mysqlDatabaseName01};""" - - sql """drop table if exists ${mysqlTableName01}""" - - sql """ - CREATE EXTERNAL TABLE ${mysqlTableName01} - ( - `id` int, - `name` varchar(128) - ) - ENGINE = mysql - PROPERTIES - ( - "host" = "${extMysqlHost}", - "port" = "${extMysqlPort}", - "user" = "${extMysqlUser}", - "password" = "${extMysqlPassword}", - "database" = "doris_test", - "table" = "ex_tb0", - "charset" = "utf8mb4" - ); - """ - // ERROR 1105 (HY000): errCode = 2, detailMessage = Don't support MySQL table, you should rebuild Doris with WITH_MYSQL option ON - - def res = sql """select count(*) from ${mysqlTableName01}""" - logger.info("recoding select: " + res.toString()) - - - sql """drop table if exists ${mysqlTableName01}""" - sql """drop database if exists ${mysqlDatabaseName01};""" - - } -} - - - - - - - diff --git a/regression-test/suites/external_table_emr_p2/mysql/test_external_resource_mysql.groovy b/regression-test/suites/external_table_emr_p2/mysql/test_external_resource_mysql.groovy index ac58b351aee6da..fe1e84e607cd5b 100644 --- a/regression-test/suites/external_table_emr_p2/mysql/test_external_resource_mysql.groovy +++ b/regression-test/suites/external_table_emr_p2/mysql/test_external_resource_mysql.groovy @@ -1,3 +1,4 @@ +package suites.external_table_emr_p2.mysql // 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 @@ -24,8 +25,16 @@ suite("test_external_resource_mysql", "p2") { String extMysqlUser = context.config.otherConfigs.get("extMysqlUser") String extMysqlPassword = context.config.otherConfigs.get("extMysqlPassword") String mysqlResourceName = "jdbc_resource_mysql_57" - String mysqlDatabaseName01 = "external_mysql_database01" - String mysqlTableName01 = "external_mysql_table01" + String mysqlDatabaseName01 = "external_mysql_database_ssb" + String mysqlTableNameLineOrder = "external_mysql_table_lineorder" + String mysqlTableNameCustomer = "external_mysql_table_customer" + String mysqlTableNameSupplier = "external_mysql_table_supplier" + + + + sql """drop database if exists ${mysqlDatabaseName01};""" + sql """create database ${mysqlDatabaseName01};""" + sql """use ${mysqlDatabaseName01};""" sql """drop resource if exists ${mysqlResourceName};""" sql """ @@ -34,33 +43,103 @@ suite("test_external_resource_mysql", "p2") { "type"="jdbc", "user"="${extMysqlUser}", "password"="${extMysqlPassword}", - "jdbc_url"="jdbc:mysql://${extMysqlHost}:${extMysqlPort}/doris_test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false", + "jdbc_url"="jdbc:mysql://${extMysqlHost}:${extMysqlPort}/ssb?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false", "driver_url"="https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/jdbc_driver/mysql-connector-java-8.0.25.jar", "driver_class"="com.mysql.cj.jdbc.Driver" ); """ - sql """drop database if exists ${mysqlDatabaseName01};""" - sql """create database ${mysqlDatabaseName01};""" - sql """use ${mysqlDatabaseName01};""" - sql """drop table if exists ${mysqlTableName01}""" + + sql """drop table if exists ${mysqlTableNameLineOrder}""" sql """ - CREATE EXTERNAL TABLE ${mysqlTableName01} ( - `id` int, - `name` varchar(128) + CREATE EXTERNAL TABLE ${mysqlTableNameLineOrder} ( + `lo_orderkey` bigint(20) NOT NULL COMMENT "", + `lo_linenumber` bigint(20) NOT NULL COMMENT "", + `lo_custkey` int(11) NOT NULL COMMENT "", + `lo_partkey` int(11) NOT NULL COMMENT "", + `lo_suppkey` int(11) NOT NULL COMMENT "", + `lo_orderdate` int(11) NOT NULL COMMENT "", + `lo_orderpriority` varchar(16) NOT NULL COMMENT "", + `lo_shippriority` int(11) NOT NULL COMMENT "", + `lo_quantity` bigint(20) NOT NULL COMMENT "", + `lo_extendedprice` bigint(20) NOT NULL COMMENT "", + `lo_ordtotalprice` bigint(20) NOT NULL COMMENT "", + `lo_discount` bigint(20) NOT NULL COMMENT "", + `lo_revenue` bigint(20) NOT NULL COMMENT "", + `lo_supplycost` bigint(20) NOT NULL COMMENT "", + `lo_tax` bigint(20) NOT NULL COMMENT "", + `lo_commitdate` bigint(20) NOT NULL COMMENT "", + `lo_shipmode` varchar(11) NOT NULL COMMENT "" ) ENGINE=JDBC PROPERTIES ( "resource" = "${mysqlResourceName}", - "table" = "ex_tb0", + "table" = "lineorder", "table_type"="mysql" ); """ - def res = sql """select count(*) from ${mysqlTableName01};""" + def res = sql """select * from ${mysqlTableNameLineOrder} limit 10;""" logger.info("recoding select: " + res.toString()) - sql """drop table if exists ${mysqlTableName01}""" - sql """drop database if exists ${mysqlDatabaseName01};""" + sql """drop table if exists ${mysqlTableNameCustomer}""" + sql """ + CREATE EXTERNAL TABLE ${mysqlTableNameCustomer} ( + `c_custkey` int(11) DEFAULT NULL, + `c_name` varchar(25) NOT NULL, + `c_address` varchar(40) NOT NULL, + `c_city` varchar(10) NOT NULL, + `c_nation` varchar(15) NOT NULL, + `c_region` varchar(12) NOT NULL, + `c_phone` varchar(15) NOT NULL + ) ENGINE=JDBC + PROPERTIES ( + "resource" = "${mysqlResourceName}", + "table" = "customer", + "table_type"="mysql" + ); + """ + + def res1 = sql """select * from ${mysqlTableNameCustomer} where c_custkey >100 limit 10;""" + logger.info("recoding select: " + res1.toString()) + + def res2 = sql """select * from ${mysqlTableNameCustomer} order by c_custkey desc limit 10;""" + logger.info("recoding select: " + res2.toString()) + +// def res3 = sql """select AVG(lo_discount) from ${mysqlTableNameCustomer} limit 10;""" +// logger.info("recoding select: " + res3.toString()) +// +// def res4 = sql """select MAX(lo_discount) from ${mysqlTableNameCustomer} limit 10;""" +// logger.info("recoding select: " + res4.toString()) + + def res5 = sql """select count(*) from ${mysqlTableNameCustomer};""" + logger.info("recoding select: " + res5.toString()) + + sql """drop table if exists ${mysqlTableNameSupplier}""" + sql """ + CREATE EXTERNAL TABLE ${mysqlTableNameSupplier} ( + `s_suppkey` int(11) DEFAULT NULL, + `s_name` varchar(25) NOT NULL, + `s_address` varchar(25) NOT NULL, + `s_city` varchar(10) NOT NULL, + `s_nation` varchar(15) NOT NULL, + `s_region` varchar(12) NOT NULL, + `s_phone` varchar(15) NOT NULL + ) ENGINE=JDBC + PROPERTIES ( + "resource" = "${mysqlResourceName}", + "table" = "customer", + "table_type"="mysql" + ); + """ + def res6 = sql """select count(*) from ${mysqlTableNameSupplier};""" + logger.info("recoding select: " + res6.toString()) + + def res7 = sql """select * from ${mysqlTableNameCustomer} a join ${mysqlTableNameSupplier} b on a.c_nation =b.s_nation limit 5;""" + logger.info("recoding select: " + res7.toString()) + + + sql """drop table if exists ${mysqlTableNameLineOrder}""" + sql """drop database if exists ${mysqlDatabaseName01};""" } } diff --git a/regression-test/suites/external_table_emr_p2/pg/test_external_pg.groovy b/regression-test/suites/external_table_emr_p2/pg/test_external_pg.groovy index 58b2f6b94652d2..ce92ff4aea06d4 100644 --- a/regression-test/suites/external_table_emr_p2/pg/test_external_pg.groovy +++ b/regression-test/suites/external_table_emr_p2/pg/test_external_pg.groovy @@ -1,3 +1,4 @@ +package suites.external_table_emr_p2.pg // 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 @@ -25,7 +26,10 @@ suite("test_external_pg", "p2") { String extPgPassword = context.config.otherConfigs.get("extPgPassword") String jdbcResourcePg14 = "jdbc_resource_pg_14" String jdbcPg14Database1 = "jdbc_pg_14_database1" - String jdbcPg14Table1 = "jdbc_pg_14_table1" + String pgTableNameLineOrder = "jdbc_pg_14_table1" + String pgTableNameCustomer = "jdbc_pg_14_customer" + String pgTableNameSupplier = "jdbc_pg_14_supplier" + sql """drop database if exists ${jdbcPg14Database1};""" @@ -38,29 +42,95 @@ suite("test_external_pg", "p2") { "type"="jdbc", "user"="${extPgUser}", "password"="${extPgPassword}", - "jdbc_url"="jdbc:postgresql://${extPgHost}:${extPgPort}/exter_test?currentSchema=public", + "jdbc_url"="jdbc:postgresql://${extPgHost}:${extPgPort}/ssb?currentSchema=ssb", "driver_url"="https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/jdbc_driver/postgresql-42.5.0.jar", "driver_class"="org.postgresql.Driver" ); """ - sql """drop table if exists ${jdbcPg14Table1}""" + sql """drop table if exists ${pgTableNameLineOrder}""" sql """ - CREATE EXTERNAL TABLE ${jdbcPg14Table1} ( - id int, - name char(100) + CREATE EXTERNAL TABLE ${pgTableNameLineOrder} ( + `lo_orderkey` bigint(20) NOT NULL COMMENT "", + `lo_linenumber` bigint(20) NOT NULL COMMENT "", + `lo_custkey` int(11) NOT NULL COMMENT "", + `lo_partkey` int(11) NOT NULL COMMENT "", + `lo_suppkey` int(11) NOT NULL COMMENT "", + `lo_orderdate` int(11) NOT NULL COMMENT "", + `lo_orderpriority` varchar(16) NOT NULL COMMENT "", + `lo_shippriority` int(11) NOT NULL COMMENT "", + `lo_quantity` bigint(20) NOT NULL COMMENT "", + `lo_extendedprice` bigint(20) NOT NULL COMMENT "", + `lo_ordtotalprice` bigint(20) NOT NULL COMMENT "", + `lo_discount` bigint(20) NOT NULL COMMENT "", + `lo_revenue` bigint(20) NOT NULL COMMENT "", + `lo_supplycost` bigint(20) NOT NULL COMMENT "", + `lo_tax` bigint(20) NOT NULL COMMENT "", + `lo_commitdate` bigint(20) NOT NULL COMMENT "", + `lo_shipmode` varchar(11) NOT NULL COMMENT "" ) ENGINE=JDBC PROPERTIES ( "resource" = "${jdbcResourcePg14}", - "table" = "ext_pg0", + "table" = "lineorder", "table_type"="postgresql" ); """ - def res = sql """SELECT id, name FROM ${jdbcPg14Table1};""" + sql """drop table if exists ${pgTableNameCustomer}""" + sql """ + CREATE EXTERNAL TABLE ${pgTableNameCustomer} ( + `c_custkey` int(11) DEFAULT NULL, + `c_name` varchar(25) NOT NULL, + `c_address` varchar(40) NOT NULL, + `c_city` varchar(10) NOT NULL, + `c_nation` varchar(15) NOT NULL, + `c_region` varchar(12) NOT NULL, + `c_phone` varchar(15) NOT NULL + ) ENGINE=JDBC + PROPERTIES ( + "resource" = "${jdbcResourcePg14}", + "table" = "customer", + "table_type"="mysql" + ); + """ + + sql """drop table if exists ${pgTableNameSupplier}""" + sql """ + CREATE EXTERNAL TABLE ${pgTableNameSupplier} ( + `s_suppkey` int(11) DEFAULT NULL, + `s_name` varchar(25) NOT NULL, + `s_address` varchar(25) NOT NULL, + `s_city` varchar(10) NOT NULL, + `s_nation` varchar(15) NOT NULL, + `s_region` varchar(12) NOT NULL, + `s_phone` varchar(15) NOT NULL + ) ENGINE=JDBC + PROPERTIES ( + "resource" = "${jdbcResourcePg14}", + "table" = "customer", + "table_type"="mysql" + ); + """ + + def res = sql """select count(*) from ${pgTableNameCustomer};""" logger.info("recoding select: " + res.toString()) - sql """drop table if exists ${jdbcPg14Table1}""" + def res1 = sql """select * from ${pgTableNameSupplier} limit 10""" + logger.info("recoding select: " + res1.toString()) + + def res2 = sql """select * from ${pgTableNameSupplier} order by s_suppkey desc limit 10;""" + logger.info("recoding select: " + res2.toString()) + + def res3 = sql """select * from ${pgTableNameSupplier} where s_suppkey>100 limit 10;""" + logger.info("recoding select: " + res3.toString()) + + def res4 = sql """select * from ${pgTableNameCustomer} a join ${pgTableNameSupplier} b on a.c_nation =b.s_nation limit 5;""" + logger.info("recoding select: " + res4.toString()) + + sql """drop table if exists ${pgTableNameLineOrder}""" + sql """drop table if exists ${pgTableNameCustomer}""" + sql """drop table if exists ${pgTableNameSupplier}""" + sql """drop database if exists ${jdbcPg14Database1};""" sql """drop resource if exists ${jdbcResourcePg14};""" From 6db61676785e965b7907d86d07630149af2d8f84 Mon Sep 17 00:00:00 2001 From: zhangguoqiang <18372634969@163.com> Date: Thu, 5 Jan 2023 16:57:01 +0800 Subject: [PATCH 2/2] add external table p2 regression cases according doris1.2 docs 20230105 --- .../external_table_emr_p2/es/test_external_catalog_es.groovy | 1 - .../suites/external_table_emr_p2/es/test_external_es.groovy | 1 - .../suites/external_table_emr_p2/hive/test_external_brown.groovy | 1 - .../external_table_emr_p2/hive/test_external_catalog_hive.groovy | 1 - .../external_table_emr_p2/hive/test_external_github.groovy | 1 - .../suites/external_table_emr_p2/hive/test_external_hive.groovy | 1 - .../external_table_emr_p2/hive/test_external_yandex.groovy | 1 - .../mysql/test_external_catalog_mysql.groovy | 1 - .../mysql/test_external_resource_mysql.groovy | 1 - .../suites/external_table_emr_p2/pg/test_external_pg.groovy | 1 - 10 files changed, 10 deletions(-) diff --git a/regression-test/suites/external_table_emr_p2/es/test_external_catalog_es.groovy b/regression-test/suites/external_table_emr_p2/es/test_external_catalog_es.groovy index bd496ae3013f63..1234d22d51bad6 100644 --- a/regression-test/suites/external_table_emr_p2/es/test_external_catalog_es.groovy +++ b/regression-test/suites/external_table_emr_p2/es/test_external_catalog_es.groovy @@ -1,4 +1,3 @@ -package suites.external_table_emr_p2.es // 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 diff --git a/regression-test/suites/external_table_emr_p2/es/test_external_es.groovy b/regression-test/suites/external_table_emr_p2/es/test_external_es.groovy index 9be1bb66a3cdb7..f5a902a3a7e35f 100644 --- a/regression-test/suites/external_table_emr_p2/es/test_external_es.groovy +++ b/regression-test/suites/external_table_emr_p2/es/test_external_es.groovy @@ -1,4 +1,3 @@ -package suites.external_table_emr_p2.es // 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 diff --git a/regression-test/suites/external_table_emr_p2/hive/test_external_brown.groovy b/regression-test/suites/external_table_emr_p2/hive/test_external_brown.groovy index 1d0f1d2629e337..8ba09f0596308c 100644 --- a/regression-test/suites/external_table_emr_p2/hive/test_external_brown.groovy +++ b/regression-test/suites/external_table_emr_p2/hive/test_external_brown.groovy @@ -1,4 +1,3 @@ -package suites.external_table_emr_p2.hive // 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 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 index b329ed048831d7..ba25807c51947c 100644 --- 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 @@ -1,4 +1,3 @@ -package suites.external_table_emr_p2.hive // 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 diff --git a/regression-test/suites/external_table_emr_p2/hive/test_external_github.groovy b/regression-test/suites/external_table_emr_p2/hive/test_external_github.groovy index 43f76762bc40dc..1dd52173b6622c 100644 --- a/regression-test/suites/external_table_emr_p2/hive/test_external_github.groovy +++ b/regression-test/suites/external_table_emr_p2/hive/test_external_github.groovy @@ -1,4 +1,3 @@ -package suites.external_table_emr_p2.hive // 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 diff --git a/regression-test/suites/external_table_emr_p2/hive/test_external_hive.groovy b/regression-test/suites/external_table_emr_p2/hive/test_external_hive.groovy index 79d51376fcb1be..9ac49a0aa4dbe8 100644 --- a/regression-test/suites/external_table_emr_p2/hive/test_external_hive.groovy +++ b/regression-test/suites/external_table_emr_p2/hive/test_external_hive.groovy @@ -1,4 +1,3 @@ -package suites.external_table_emr_p2.hive // 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 diff --git a/regression-test/suites/external_table_emr_p2/hive/test_external_yandex.groovy b/regression-test/suites/external_table_emr_p2/hive/test_external_yandex.groovy index 83e8f9e6c3d904..b99524774831f6 100644 --- a/regression-test/suites/external_table_emr_p2/hive/test_external_yandex.groovy +++ b/regression-test/suites/external_table_emr_p2/hive/test_external_yandex.groovy @@ -1,4 +1,3 @@ -package suites.external_table_emr_p2.hive // 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 diff --git a/regression-test/suites/external_table_emr_p2/mysql/test_external_catalog_mysql.groovy b/regression-test/suites/external_table_emr_p2/mysql/test_external_catalog_mysql.groovy index 422f26e91d7fff..a411926d99ab41 100644 --- a/regression-test/suites/external_table_emr_p2/mysql/test_external_catalog_mysql.groovy +++ b/regression-test/suites/external_table_emr_p2/mysql/test_external_catalog_mysql.groovy @@ -1,4 +1,3 @@ -package suites.external_table_emr_p2.mysql // 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 diff --git a/regression-test/suites/external_table_emr_p2/mysql/test_external_resource_mysql.groovy b/regression-test/suites/external_table_emr_p2/mysql/test_external_resource_mysql.groovy index fe1e84e607cd5b..941317a1e0a59a 100644 --- a/regression-test/suites/external_table_emr_p2/mysql/test_external_resource_mysql.groovy +++ b/regression-test/suites/external_table_emr_p2/mysql/test_external_resource_mysql.groovy @@ -1,4 +1,3 @@ -package suites.external_table_emr_p2.mysql // 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 diff --git a/regression-test/suites/external_table_emr_p2/pg/test_external_pg.groovy b/regression-test/suites/external_table_emr_p2/pg/test_external_pg.groovy index ce92ff4aea06d4..e39fb44f76ce15 100644 --- a/regression-test/suites/external_table_emr_p2/pg/test_external_pg.groovy +++ b/regression-test/suites/external_table_emr_p2/pg/test_external_pg.groovy @@ -1,4 +1,3 @@ -package suites.external_table_emr_p2.pg // 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