Skip to content

Commit

Permalink
[regresstion][external]fix case test_show_where and es_query 0811 (ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangguoqiang666 authored Aug 12, 2023
1 parent 1f8cb3f commit 41ff48f
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
-- under the License.

drop database if exists doris_test;
drop database if exists show_test_do_not_modify;
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
-- under the License.

create database doris_test;
create database show_test_do_not_modify;
13 changes: 13 additions & 0 deletions docker/thirdparties/docker-compose/mysql/init/03-create-table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,16 @@ CREATE TABLE doris_test.dt_null (
CREATE VIEW doris_test.mysql_view as
select 10086 as col_1, 4294967295 as col_2, tinyint_u as col_3 from doris_test.all_types where tinyint_u=201;

CREATE TABLE show_test_do_not_modify.ex_tb0 (
`id` int PRIMARY KEY,
`name` varchar(128)
);

CREATE TABLE show_test_do_not_modify.ex_tb1 (
id varchar(128)
);

CREATE TABLE show_test_do_not_modify.ex_tb2 (
id int,
count_value varchar(20)
);
6 changes: 6 additions & 0 deletions docker/thirdparties/docker-compose/mysql/init/04-insert.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
-- specific language governing permissions and limitations
-- under the License.

insert into show_test_do_not_modify.ex_tb0 values (111, 'abc'), (112, 'abd'), (113, 'abe'),(114, 'abf'),(115, 'abg');

insert into show_test_do_not_modify.ex_tb1 values ('{"k1":"v1", "k2":"v2"}');

insert into show_test_do_not_modify.ex_tb2 values (123, '10'), (123, '15'), (123, '20');

insert into doris_test.test1 values
(true, 'abc', 'efg', '2022-10-01', 3.4, 1, 2, 0, 100000, 1.2, '2022-10-02 12:59:01', 24.000),
(true, 'abc', 'efg', '2022-10-01', 3.4, 1, 2, 1, 100000, 1.2, '2022-10-02 12:59:01', 24.000),
Expand Down
44 changes: 44 additions & 0 deletions regression-test/data/nereids_p0/show/test_show_where.out
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,47 @@ ex_tb1
ex_tb0
ex_tb1

-- !select --
show_test_do_not_modify

-- !select --
ex_tb0
ex_tb1
ex_tb2

-- !select --
ex_tb0

-- !select --
ex_tb0
ex_tb1
ex_tb2

-- !select --
ex_tb0
ex_tb1

-- !select --
ex_tb0
ex_tb1
ex_tb2

-- !select --
doris_test

-- !select --
ex_tb0
ex_tb1

-- !select --
ex_tb1

-- !select --
ex_tb0
ex_tb1

-- !select --
ex_tb0
ex_tb1
ex_tb2

44 changes: 44 additions & 0 deletions regression-test/data/query_p0/show/test_show_where.out
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,47 @@ ex_tb1
ex_tb0
ex_tb1

-- !select --
show_test_do_not_modify

-- !select --
ex_tb0
ex_tb1
ex_tb2

-- !select --
ex_tb0

-- !select --
ex_tb0
ex_tb1
ex_tb2

-- !select --
ex_tb0
ex_tb1

-- !select --
ex_tb0
ex_tb1
ex_tb2

-- !select --
doris_test

-- !select --
ex_tb0
ex_tb1

-- !select --
ex_tb1

-- !select --
ex_tb0
ex_tb1

-- !select --
ex_tb0
ex_tb1
ex_tb2

Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ suite("test_es_query_no_http_url", "p0,external,es,external_docker,external_dock

// test old create-catalog syntax for compatibility
sql """
create catalog es6
properties (
create catalog if not exists es6 properties (
"type"="es",
"elasticsearch.hosts"="${externalEnvIp}:$es_6_port",
"elasticsearch.nodes_discovery"="false",
Expand All @@ -42,19 +41,21 @@ suite("test_es_query_no_http_url", "p0,external,es,external_docker,external_dock
"""

// test new create catalog syntax
sql """create catalog if not exists es7 properties(
"type"="es",
"hosts"="${externalEnvIp}:$es_7_port",
"nodes_discovery"="false",
"enable_keyword_sniff"="true"
sql """
create catalog if not exists es7 properties(
"type"="es",
"hosts"="${externalEnvIp}:$es_7_port",
"nodes_discovery"="false",
"enable_keyword_sniff"="true"
);
"""

sql """create catalog if not exists es8 properties(
"type"="es",
"hosts"="${externalEnvIp}:$es_8_port",
"nodes_discovery"="false",
"enable_keyword_sniff"="true"
sql """
create catalog if not exists es8 properties(
"type"="es",
"hosts"="${externalEnvIp}:$es_8_port",
"nodes_discovery"="false",
"enable_keyword_sniff"="true"
);
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

suite("test_truncate_char_or_varchar_columns", "p2") {
suite("test_truncate_char_or_varchar_columns", "p2,external,hive,external_remote,external_remote_hive") {
String enabled = context.config.otherConfigs.get("enableExternalHiveTest")
if (enabled != null && enabled.equalsIgnoreCase("true")) {
String extHiveHmsHost = context.config.otherConfigs.get("extHiveHmsHost")
Expand Down
15 changes: 8 additions & 7 deletions regression-test/suites/nereids_p0/show/test_show_where.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,29 @@ suite("test_show_where", "query,external,mysql,external_docker,external_docker_m
String enabled = context.config.otherConfigs.get("enableJdbcTest")
String mysql_port = context.config.otherConfigs.get("mysql_57_port");
if (enabled != null && enabled.equalsIgnoreCase("true")) {

String mysql_show_db="show_test_do_not_modify"

sql """drop catalog if exists ${catalog_name} """

// if use 'com.mysql.cj.jdbc.Driver' here, it will report: ClassNotFound
sql """ CREATE CATALOG ${catalog_name} PROPERTIES (
"type"="jdbc",
"jdbc.user"="root",
"jdbc.password"="123456",
"jdbc.jdbc_url" = "jdbc:mysql://${externalEnvIp}:${mysql_port}/doris_test?useSSL=false",
"jdbc.jdbc_url" = "jdbc:mysql://${externalEnvIp}:${mysql_port}/show_test_do_not_modify?useSSL=false",
"jdbc.driver_url" = "${driver_url}",
"jdbc.driver_class" = "com.mysql.cj.jdbc.Driver");
"""

sql """switch ${catalog_name}"""
sql """ use ${ex_db_name}"""
sql """ use ${mysql_show_db}"""

qt_select "show databases where schema_name= '${ex_db_name}'"
qt_select "show databases where schema_name= '${mysql_show_db}'"
qt_select "show tables"
qt_select "show tables where table_name= '${ex_tb0}'"
qt_select "show tables from ${ex_db_name}"
qt_select "show tables from ${mysql_show_db}"
qt_select "show tables from internal.${ex_db_name}"
qt_select "show tables from ${catalog_name}.${ex_db_name}"
qt_select "show tables from ${catalog_name}.${mysql_show_db}"


sql """switch internal"""
Expand All @@ -89,7 +90,7 @@ suite("test_show_where", "query,external,mysql,external_docker,external_docker_m
qt_select "show tables"
qt_select "show tables where table_name= '${ex_tb1}'"
qt_select "show tables from internal.${ex_db_name}"
qt_select "show tables from ${catalog_name}.${ex_db_name}"
qt_select "show tables from ${catalog_name}.${mysql_show_db}"

}

Expand Down
15 changes: 8 additions & 7 deletions regression-test/suites/query_p0/show/test_show_where.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,29 @@ suite("test_show_where", "query,external,mysql,external_docker,external_docker_m
String enabled = context.config.otherConfigs.get("enableJdbcTest")
String mysql_port = context.config.otherConfigs.get("mysql_57_port");
if (enabled != null && enabled.equalsIgnoreCase("true")) {

String mysql_show_db="show_test_do_not_modify"

sql """drop catalog if exists ${catalog_name} """

// if use 'com.mysql.cj.jdbc.Driver' here, it will report: ClassNotFound
sql """ CREATE CATALOG ${catalog_name} PROPERTIES (
"type"="jdbc",
"jdbc.user"="root",
"jdbc.password"="123456",
"jdbc.jdbc_url" = "jdbc:mysql://${externalEnvIp}:${mysql_port}/doris_test?useSSL=false",
"jdbc.jdbc_url" = "jdbc:mysql://${externalEnvIp}:${mysql_port}/show_test_do_not_modify?useSSL=false",
"jdbc.driver_url" = "${driver_url}",
"jdbc.driver_class" = "com.mysql.cj.jdbc.Driver");
"""

sql """switch ${catalog_name}"""
sql """ use ${ex_db_name}"""
sql """ use ${mysql_show_db}"""

qt_select "show databases where schema_name= '${ex_db_name}'"
qt_select "show databases where schema_name= '${mysql_show_db}'"
qt_select "show tables"
qt_select "show tables where table_name= '${ex_tb0}'"
qt_select "show tables from ${ex_db_name}"
qt_select "show tables from ${mysql_show_db}"
qt_select "show tables from internal.${ex_db_name}"
qt_select "show tables from ${catalog_name}.${ex_db_name}"
qt_select "show tables from ${catalog_name}.${mysql_show_db}"


sql """switch internal"""
Expand All @@ -87,7 +88,7 @@ suite("test_show_where", "query,external,mysql,external_docker,external_docker_m
qt_select "show tables"
qt_select "show tables where table_name= '${ex_tb1}'"
qt_select "show tables from internal.${ex_db_name}"
qt_select "show tables from ${catalog_name}.${ex_db_name}"
qt_select "show tables from ${catalog_name}.${mysql_show_db}"

}

Expand Down

0 comments on commit 41ff48f

Please sign in to comment.