This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit ccb7e3779cbf68d418bfe9effb3fd3372028b108 Author: Petrichor <[email protected]> AuthorDate: Sun Oct 22 22:51:03 2023 -0500 [regresstion-test](jdbc catalog)Mariadb compatible test (#25664) --- .../docker-compose/mariadb/init/01-drop-db.sql | 18 ++++ .../docker-compose/mariadb/init/02-create-db.sql | 18 ++++ .../mariadb/init/03-create-table.sql | 76 +++++++++++++ .../docker-compose/mariadb/init/04-insert.sql | 36 +++++++ .../docker-compose/mariadb/mariadb-10.env | 19 ++++ .../docker-compose/mariadb/mariadb-10.yaml.tpl | 49 +++++++++ docker/thirdparties/run-thirdparties-docker.sh | 26 ++++- regression-test/conf/regression-conf.groovy | 1 + .../jdbc/test_mariadb_jdbc_catalog.out | 117 +++++++++++++++++++++ .../pipeline/p0/conf/regression-conf.groovy | 2 +- .../jdbc/test_mariadb_jdbc_catalog.groovy | 82 +++++++++++++++ 11 files changed, 439 insertions(+), 5 deletions(-) diff --git a/docker/thirdparties/docker-compose/mariadb/init/01-drop-db.sql b/docker/thirdparties/docker-compose/mariadb/init/01-drop-db.sql new file mode 100644 index 00000000000..d0db4a7e1ac --- /dev/null +++ b/docker/thirdparties/docker-compose/mariadb/init/01-drop-db.sql @@ -0,0 +1,18 @@ +-- 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. + +drop database if exists doris_test; diff --git a/docker/thirdparties/docker-compose/mariadb/init/02-create-db.sql b/docker/thirdparties/docker-compose/mariadb/init/02-create-db.sql new file mode 100644 index 00000000000..f87b6922d9f --- /dev/null +++ b/docker/thirdparties/docker-compose/mariadb/init/02-create-db.sql @@ -0,0 +1,18 @@ +-- 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. + +create database doris_test; diff --git a/docker/thirdparties/docker-compose/mariadb/init/03-create-table.sql b/docker/thirdparties/docker-compose/mariadb/init/03-create-table.sql new file mode 100644 index 00000000000..e82da905dca --- /dev/null +++ b/docker/thirdparties/docker-compose/mariadb/init/03-create-table.sql @@ -0,0 +1,76 @@ +-- 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. + +CREATE TABLE doris_test.ex_tb0 +( + `id` int PRIMARY KEY, + `name` varchar(128) +); + +create table doris_test.all_types ( + `tinyint_u` tinyint unsigned, + `smallint_u` smallint unsigned, + `mediumint_u` mediumint unsigned, + `int_u` int unsigned, + `bigint_u` bigint unsigned, + `decimal_u` decimal(18, 5) unsigned, + `double_u` double unsigned, + `float_u` float unsigned, + `boolean` boolean, + `tinyint` tinyint, + `smallint` smallint, + `year` year, + `mediumint` mediumint, + `int` int, + `bigint` bigint, + `date` date, + `timestamp` timestamp(4) null, + `datetime` datetime, + `float` float, + `double` double, + `decimal` decimal(12, 4), + `char` char(5), + `varchar` varchar(10), + `time` time(4), + `text` text, + `blob` blob, + `json` json, + `set` set('Option1', 'Option2', 'Option3'), + `bit` bit(6), + `binary` binary(12), + `varbinary` varbinary(12), + `enum` enum('Value1', 'Value2', 'Value3') +) engine=innodb charset=utf8; + +CREATE TABLE `doris_test`.`auto_default_t` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `name` varchar(64) DEFAULT NULL, + `dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) engine=innodb charset=utf8; + +CREATE TABLE doris_test.dt ( + `timestamp0` timestamp(0) DEFAULT CURRENT_TIMESTAMP(), + `timestamp1` timestamp(0) DEFAULT CURRENT_TIMESTAMP(0), + `timestamp2` timestamp(1) DEFAULT CURRENT_TIMESTAMP(1), + `timestamp3` timestamp(2) DEFAULT CURRENT_TIMESTAMP(2), + `timestamp4` timestamp(3) DEFAULT CURRENT_TIMESTAMP(3), + `timestamp5` timestamp(4) DEFAULT CURRENT_TIMESTAMP(4), + `timestamp6` timestamp(5) DEFAULT CURRENT_TIMESTAMP(5), + `timestamp7` timestamp(6) DEFAULT CURRENT_TIMESTAMP(6) +) ENGINE=INNODB CHARSET=utf8; + diff --git a/docker/thirdparties/docker-compose/mariadb/init/04-insert.sql b/docker/thirdparties/docker-compose/mariadb/init/04-insert.sql new file mode 100644 index 00000000000..5856e419e7c --- /dev/null +++ b/docker/thirdparties/docker-compose/mariadb/init/04-insert.sql @@ -0,0 +1,36 @@ +-- 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. +insert into doris_test.ex_tb0 values (111, 'abc'), (112, 'abd'), (113, 'abe'),(114, 'abf'),(115, 'abg'); + +INSERT INTO doris_test.all_types VALUES +(201, 301, 401, 501, 601, 3.14159, 4.1415926, 5.141592, true, -123, -301, 2012, -401, -501, -601, '2012-10-30', '2012-10-25 12:05:36.3456712', '2012-10-25 08:08:08.3456712', + -4.14145001, -5.1400000001, -6.140000001, 'row1', 'line1', '09:09:09.56782346', 'text1', X'48656C6C6F20576F726C64', '{"name": "Alice", "age": 30, "city": "London"}', + 'Option1,Option3', b'101010', X'48656C6C6F', X'48656C6C6F', 'Value2'), +(202, 302, 402, 502, 602, 4.14159, 5.1415926, 6.141592, false, -124, -302, 2013, -402, -502, -602, '2012-11-01', '2012-10-26 02:08:39.3456712', '2013-10-26 08:09:18.3456712', + -5.14145001, -6.1400000001, -7.140000001, 'row2', 'line2', '09:11:09.56782346', 'text2', X'E86F6C6C6F20576F726C67', '{"name": "Gaoxin", "age": 18, "city": "ChongQing"}', + 'Option1,Option2', b'101111', X'58676C6C6F', X'88656C6C9F', 'Value3'), +(null, 302, null, 502, 602, 4.14159, null, 6.141592, null, -124, -302, 2013, -402, -502, -602, null, '2012-10-26 02:08:39.3456712', '2013-10-26 08:09:18.3456712', + -5.14145001, null, -7.140000001, 'row2', null, '09:11:09.56782346', 'text2', X'E86F6C6C6F20576F726C67', null, + null, b'101111', null, X'88656C6C9F', 'Value3'), +(203, 303, 403, 503, 603, 7.14159, 8.1415926, 9.141592, false, null, -402, 2017, -602, -902, -1102, '2012-11-02', null, '2013-10-27 08:11:18.3456712', + -5.14145000001, -6.1400000000001, -7.140000000001, 'row3', 'line3', '09:11:09.56782346', 'text3', X'E86F6C6C6F20576F726C67', '{"name": "ChenQi", "age": 24, "city": "ChongQing"}', + 'Option2', b'101111', X'58676C6C6F', null, 'Value1'); + +INSERT INTO doris_test.dt (`timestamp0`, `timestamp1`, `timestamp2`, `timestamp3`, `timestamp4`, `timestamp5`, `timestamp6`,`timestamp7`) +VALUES ('2023-06-17 10:00:00', '2023-06-17 10:00:01.1', '2023-06-17 10:00:02.22', '2023-06-17 10:00:03.333', + '2023-06-17 10:00:04.4444', '2023-06-17 10:00:05.55555', '2023-06-17 10:00:06.666666','2023-06-17 10:00:06.666666'); + diff --git a/docker/thirdparties/docker-compose/mariadb/mariadb-10.env b/docker/thirdparties/docker-compose/mariadb/mariadb-10.env new file mode 100644 index 00000000000..a8537d46f81 --- /dev/null +++ b/docker/thirdparties/docker-compose/mariadb/mariadb-10.env @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# 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. + +DOCKER_MARIADB_EXTERNAL_PORT=3326 diff --git a/docker/thirdparties/docker-compose/mariadb/mariadb-10.yaml.tpl b/docker/thirdparties/docker-compose/mariadb/mariadb-10.yaml.tpl new file mode 100644 index 00000000000..ad3f3109549 --- /dev/null +++ b/docker/thirdparties/docker-compose/mariadb/mariadb-10.yaml.tpl @@ -0,0 +1,49 @@ +# +# 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. +# + +version: "3.1" + +services: + doris--mariadb: + image: mariadb:10.4 + command: --default-authentication-plugin=mysql_native_password + restart: always + environment: + MARIADB_ROOT_PASSWORD: 123456 + MARIADBL_DATABASE: init_db + # set terminal charset + LANG: C.UTF-8 + ports: + - ${DOCKER_MARIADB_EXTERNAL_PORT}:3306 + healthcheck: + test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MARIADB_ROOT_PASSWORD + interval: 5s + timeout: 60s + retries: 120 + volumes: + - ./data/:/var/lib/mysql + - ./init:/docker-entrypoint-initdb.d + networks: + - doris--mariadb + hello-world: + image: hello-world + depends_on: + doris--mariadb: + condition: service_healthy + +networks: + doris--mariadb: diff --git a/docker/thirdparties/run-thirdparties-docker.sh b/docker/thirdparties/run-thirdparties-docker.sh index d1065fa4dd9..bf2cc1de744 100755 --- a/docker/thirdparties/run-thirdparties-docker.sh +++ b/docker/thirdparties/run-thirdparties-docker.sh @@ -37,7 +37,7 @@ Usage: $0 <options> --stop stop the specified components All valid components: - mysql,pg,oracle,sqlserver,clickhouse,es,hive,iceberg,kafka,hudi,trino + mysql,pg,oracle,sqlserver,clickhouse,es,hive,iceberg,hudi,trino,kafka,mariadb " exit 1 } @@ -60,7 +60,7 @@ STOP=0 if [[ "$#" == 1 ]]; then # default - COMPONENTS="mysql,es,hive,pg,oracle,sqlserver,clickhouse" + COMPONENTS="mysql,es,hive,pg,oracle,sqlserver,clickhouse,mariadb" else while true; do case "$1" in @@ -92,7 +92,7 @@ else done if [[ "${COMPONENTS}"x == ""x ]]; then if [[ "${STOP}" -eq 1 ]]; then - COMPONENTS="mysql,pg,oracle,sqlserver,clickhouse,hive,iceberg,kafka,hudi,trino" + COMPONENTS="mysql,es,pg,oracle,sqlserver,clickhouse,hive,iceberg,hudi,trino,kafka,mariadb" fi fi fi @@ -128,9 +128,11 @@ RUN_CLICKHOUSE=0 RUN_HIVE=0 RUN_ES=0 RUN_ICEBERG=0 -RUN_KAFKA=0 RUN_HUDI=0 RUN_TRINO=0 +RUN_KAFKA=0 +RUN_SPARK=0 +RUN_MARIADB=0 for element in "${COMPONENTS_ARR[@]}"; do if [[ "${element}"x == "mysql"x ]]; then @@ -155,6 +157,10 @@ for element in "${COMPONENTS_ARR[@]}"; do RUN_HUDI=1 elif [[ "${element}"x == "trino"x ]];then RUN_TRINO=1 + elif [[ "${element}"x == "spark"x ]];then + RUN_SPARK=1 + elif [[ "${element}"x == "mariadb"x ]];then + RUN_MARIADB=1 else echo "Invalid component: ${element}" usage @@ -422,3 +428,15 @@ if [[ "${RUN_TRINO}" -eq 1 ]]; then docker exec -it ${TRINO_CONTAINER_ID} /bin/bash -c 'trino -f /scripts/create_trino_table.sql' fi fi + +if [[ "${RUN_MARIADB}" -eq 1 ]]; then + # mariadb + cp "${ROOT}"/docker-compose/mariadb/mariadb-10.yaml.tpl "${ROOT}"/docker-compose/mariadb/mariadb-10.yaml + sed -i "s/doris--/${CONTAINER_UID}/g" "${ROOT}"/docker-compose/mariadb/mariadb-10.yaml + sudo docker compose -f "${ROOT}"/docker-compose/mariadb/mariadb-10.yaml --env-file "${ROOT}"/docker-compose/mariadb/mariadb-10.env down + if [[ "${STOP}" -ne 1 ]]; then + sudo mkdir -p "${ROOT}"/docker-compose/mariadb/data/ + sudo rm "${ROOT}"/docker-compose/mariadb/data/* -rf + sudo docker compose -f "${ROOT}"/docker-compose/mariadb/mariadb-10.yaml --env-file "${ROOT}"/docker-compose/mariadb/mariadb-10.env up -d + fi +fi diff --git a/regression-test/conf/regression-conf.groovy b/regression-test/conf/regression-conf.groovy index d6001476392..a7cb35fdf4f 100644 --- a/regression-test/conf/regression-conf.groovy +++ b/regression-test/conf/regression-conf.groovy @@ -93,6 +93,7 @@ oracle_11_port=1521 sqlserver_2022_port=1433 clickhouse_22_port=8123 doris_port=9030 +mariadb_10_port=3326 // hive catalog test config // To enable hive/paimon test, you need first start hive container. diff --git a/regression-test/data/external_table_p0/jdbc/test_mariadb_jdbc_catalog.out b/regression-test/data/external_table_p0/jdbc/test_mariadb_jdbc_catalog.out new file mode 100644 index 00000000000..f6641395575 --- /dev/null +++ b/regression-test/data/external_table_p0/jdbc/test_mariadb_jdbc_catalog.out @@ -0,0 +1,117 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !sql -- +internal + +-- !sql -- +internal + +-- !sql -- +mariadb_jdbc_catalog + +-- !ex_tb0 -- +111 abc +112 abd +113 abe +114 abf +115 abg + +-- !in_tb -- +111 abc +112 abd +113 abe +114 abf +115 abg + +-- !information_schema -- +ALL_PLUGINS +APPLICABLE_ROLES +CHARACTER_SETS +CHECK_CONSTRAINTS +CLIENT_STATISTICS +COLLATIONS +COLLATION_CHARACTER_SET_APPLICABILITY +COLUMNS +COLUMN_PRIVILEGES +ENABLED_ROLES +ENGINES +EVENTS +FILES +GEOMETRY_COLUMNS +GLOBAL_STATUS +GLOBAL_VARIABLES +INDEX_STATISTICS +INNODB_BUFFER_PAGE +INNODB_BUFFER_PAGE_LRU +INNODB_BUFFER_POOL_STATS +INNODB_CMP +INNODB_CMPMEM +INNODB_CMPMEM_RESET +INNODB_CMP_PER_INDEX +INNODB_CMP_PER_INDEX_RESET +INNODB_CMP_RESET +INNODB_FT_BEING_DELETED +INNODB_FT_CONFIG +INNODB_FT_DEFAULT_STOPWORD +INNODB_FT_DELETED +INNODB_FT_INDEX_CACHE +INNODB_FT_INDEX_TABLE +INNODB_LOCKS +INNODB_LOCK_WAITS +INNODB_METRICS +INNODB_MUTEXES +INNODB_SYS_COLUMNS +INNODB_SYS_DATAFILES +INNODB_SYS_FIELDS +INNODB_SYS_FOREIGN +INNODB_SYS_FOREIGN_COLS +INNODB_SYS_INDEXES +INNODB_SYS_SEMAPHORE_WAITS +INNODB_SYS_TABLES +INNODB_SYS_TABLESPACES +INNODB_SYS_TABLESTATS +INNODB_SYS_VIRTUAL +INNODB_TABLESPACES_ENCRYPTION +INNODB_TABLESPACES_SCRUBBING +INNODB_TRX +KEYWORDS +KEY_CACHES +KEY_COLUMN_USAGE +OPTIMIZER_TRACE +PARAMETERS +PARTITIONS +PLUGINS +PROCESSLIST +PROFILING +REFERENTIAL_CONSTRAINTS +ROUTINES +SCHEMATA +SCHEMA_PRIVILEGES +SESSION_STATUS +SESSION_VARIABLES +SPATIAL_REF_SYS +SQL_FUNCTIONS +STATISTICS +SYSTEM_VARIABLES +TABLES +TABLESPACES +TABLE_CONSTRAINTS +TABLE_PRIVILEGES +TABLE_STATISTICS +TRIGGERS +USER_PRIVILEGES +USER_STATISTICS +VIEWS +user_variables + +-- !auto_default_t -- +0 + +-- !dt -- +2023-06-17T10:00 2023-06-17T10:00:01 2023-06-17T10:00:02.200 2023-06-17T10:00:03.330 2023-06-17T10:00:04.444 2023-06-17T10:00:05.555500 2023-06-17T10:00:06.666660 2023-06-17T10:00:06.666666 + +-- !mysql_all_types -- +\N 302 \N 502 602 4.14159 \N 6.14159 \N -124 -302 2013 -402 -502 -602 \N 2012-10-26T02:08:39.345600 2013-10-26T08:09:18 -5.14145 \N -7.1400 row2 \N 09:11:09.567 text2 0xE86F6C6C6F20576F726C67 \N \N 0x2F \N 0x88656C6C9F Value3 +201 301 401 501 601 3.14159 4.1415926 5.14159 1 -123 -301 2012 -401 -501 -601 2012-10-30 2012-10-25T12:05:36.345600 2012-10-25T08:08:08 -4.14145 -5.1400000001 -6.1400 row1 line1 09:09:09.567 text1 0x48656C6C6F20576F726C64 {"name": "Alice", "age": 30, "city": "London"} Option1,Option3 0x2A 0x48656C6C6F00000000000000 0x48656C6C6F Value2 +202 302 402 502 602 4.14159 5.1415926 6.14159 0 -124 -302 2013 -402 -502 -602 2012-11-01 2012-10-26T02:08:39.345600 2013-10-26T08:09:18 -5.14145 -6.1400000001 -7.1400 row2 line2 09:11:09.567 text2 0xE86F6C6C6F20576F726C67 {"name": "Gaoxin", "age": 18, "city": "ChongQing"} Option1,Option2 0x2F 0x58676C6C6F00000000000000 0x88656C6C9F Value3 +203 303 403 503 603 7.14159 8.1415926 9.14159 0 \N -402 2017 -602 -902 -1102 2012-11-02 \N 2013-10-27T08:11:18 -5.14145 -6.1400000000001 -7.1400 row3 line3 09:11:09.567 text3 0xE86F6C6C6F20576F726C67 {"name": "ChenQi", "age": 24, "city": "ChongQing"} Option2 0x2F 0x58676C6C6F00000000000000 \N Value1 + diff --git a/regression-test/pipeline/p0/conf/regression-conf.groovy b/regression-test/pipeline/p0/conf/regression-conf.groovy index 890b67a0739..d4a02176993 100644 --- a/regression-test/pipeline/p0/conf/regression-conf.groovy +++ b/regression-test/pipeline/p0/conf/regression-conf.groovy @@ -77,7 +77,7 @@ enableBrokerLoad=true enableJdbcTest=false mysql_57_port=7111 pg_14_port=7121 - +mariadb_10_port=3326 // hive catalog test config // To enable jdbc test, you need first start hive container. // See `docker/thirdparties/start-thirdparties-docker.sh` diff --git a/regression-test/suites/external_table_p0/jdbc/test_mariadb_jdbc_catalog.groovy b/regression-test/suites/external_table_p0/jdbc/test_mariadb_jdbc_catalog.groovy new file mode 100644 index 00000000000..5398263b73d --- /dev/null +++ b/regression-test/suites/external_table_p0/jdbc/test_mariadb_jdbc_catalog.groovy @@ -0,0 +1,82 @@ +// 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_mariadb_jdbc_catalog", "p0,external,mariadb,external_docker,external_docker_mariadb") { + qt_sql """select current_catalog()""" + + String enabled = context.config.otherConfigs.get("enableJdbcTest") + String externalEnvIp = context.config.otherConfigs.get("externalEnvIp") + String s3_endpoint = getS3Endpoint() + String bucket = getS3BucketName() + String driver_url = "https://${bucket}.${s3_endpoint}/regression/jdbc_driver/mysql-connector-java-8.0.25.jar" + if (enabled != null && enabled.equalsIgnoreCase("true")) { + String catalog_name = "mariadb_jdbc_catalog"; + String internal_db_name = "regression_test_jdbc_catalog_p0"; + String ex_db_name = "doris_test"; + String mariadb_port = context.config.otherConfigs.get("mariadb_10_port"); + String inDorisTable = "test_mariadb_jdbc_doris_in_tb"; + String ex_tb0 = "ex_tb0"; + String test_insert = "test_insert"; + String test_insert2 = "test_insert2"; + String auto_default_t = "auto_default_t"; + String dt = "dt"; + + sql """create database if not exists ${internal_db_name}; """ + + sql """drop catalog if exists ${catalog_name} """ + + sql """create catalog if not exists ${catalog_name} properties( + "type"="jdbc", + "user"="root", + "password"="123456", + "jdbc_url" = "jdbc:mysql://${externalEnvIp}:${mariadb_port}/doris_test?useSSL=false&zeroDateTimeBehavior=convertToNull", + "driver_url" = "${driver_url}", + "driver_class" = "com.mysql.cj.jdbc.Driver" + );""" + + sql """use ${internal_db_name}""" + sql """ drop table if exists ${internal_db_name}.${inDorisTable} """ + sql """ + CREATE TABLE ${internal_db_name}.${inDorisTable} ( + `id` INT NULL COMMENT "主键id", + `name` string NULL COMMENT "名字" + ) DISTRIBUTED BY HASH(id) BUCKETS 10 + PROPERTIES("replication_num" = "1"); + """ + + qt_sql """select current_catalog()""" + sql """switch ${catalog_name}""" + qt_sql """select current_catalog()""" + sql """ use ${ex_db_name}""" + + order_qt_ex_tb0 """ select id, name from ${ex_tb0} order by id; """ + sql """ insert into internal.${internal_db_name}.${inDorisTable} select id, name from ${ex_tb0}; """ + order_qt_in_tb """ select id, name from internal.${internal_db_name}.${inDorisTable} order by id; """ + + order_qt_information_schema """ show tables from information_schema; """ + order_qt_auto_default_t """insert into ${auto_default_t}(name) values('a'); """ + order_qt_dt """select * from ${dt}; """ + + // test all types supported by Mariadb + sql """use doris_test;""" + qt_mysql_all_types """select * from all_types order by tinyint_u;""" + + sql """ drop catalog if exists ${catalog_name} """ + + } +} + --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
