hailin0 commented on code in PR #2586: URL: https://github.com/apache/incubator-seatunnel/pull/2586#discussion_r970742612
########## seatunnel-e2e/seatunnel-spark-connector-v2-e2e/connector-doris-spark-e2e/src/test/java/org/apache/seatunnel/e2e/spark/v2/doris/FakeSourceToDorisIT.java: ########## @@ -0,0 +1,150 @@ +/* + * 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. + */ + +package org.apache.seatunnel.e2e.spark.v2.doris; + +import org.apache.seatunnel.e2e.spark.SparkContainer; + +import org.apache.commons.compress.utils.Lists; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.Container; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; +import org.testcontainers.lifecycle.Startables; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; + +public class FakeSourceToDorisIT extends SparkContainer { + private static final Logger LOG = LoggerFactory.getLogger(FakeSourceToDorisIT.class); + + private static final String DORIS_DRIVER = "com.mysql.cj.jdbc.Driver"; + private static final String DORIS_CONNECTION_URL = "jdbc:mysql://localhost:9030?rewriteBatchedStatements=true"; + private static final String DORIS_PASSWD = ""; + private static final String DORIS_USERNAME = "root"; + + private static final String DORIS_DATABASE = "test"; + private static final String DORIS_TABLE = "seatunnel"; + private static final String DORIS_DATABASE_DDL = "CREATE DATABASE IF NOT EXISTS `" + DORIS_DATABASE + "`"; + private static final String DORIS_USE_DATABASE = "USE `" + DORIS_DATABASE + "`"; + private static final String DORIS_TABLE_DDL = "CREATE TABLE IF NOT EXISTS `" + DORIS_DATABASE + "`.`" + DORIS_TABLE + "` ( " + + " `user_id` LARGEINT NOT NULL COMMENT 'id'," + + " `city` VARCHAR(20) COMMENT 'city'," + + " `age` SMALLINT COMMENT 'age'," + + " `sex` TINYINT COMMENT 'sec'," + + " `cost` BIGINT SUM DEFAULT '0' ," + + " `max_dwell_time` INT MAX DEFAULT '0' ," + + " `min_dwell_time` INT MIN DEFAULT '99999'" + + ") AGGREGATE KEY(`user_id`, `city`, `age`, `sex`) DISTRIBUTED BY HASH(`user_id`) BUCKETS 1 PROPERTIES (" + + " 'replication_allocation' = 'tag.location.default: 1'" + + ");"; + + private static final String DORIS_TABLE_TRUNCATE_TABLE = "TRUNCATE TABLE `" + DORIS_TABLE + "`"; + private static final String DORIS_SELECT_TABLE = "SELECT COUNT(*) FROM `" + DORIS_TABLE + "`"; + + //thanks zhaomin1432 provided the doris images. + private static final String DORIS_IMAGE_NAME = "zhaomin1423/doris:1.0.0-b2"; + private static final int DORIS_FE_PORT = 8030; + private static final int DORIS_QUERY_PORT = 8040; + private static final int DORIS_BE_PORT = 9030; + + private GenericContainer<?> dorisStandaloneServer; + private Connection connection; + + @BeforeEach + public void beforeInDoris() throws InterruptedException { + super.before(); + dorisStandaloneServer = new GenericContainer<>(DORIS_IMAGE_NAME) + .withNetwork(NETWORK) + .withNetworkAliases("seatunnel-doris-network") + .withLogConsumer(new Slf4jLogConsumer(LOG)); + List<String> portBindings = Lists.newArrayList(); + portBindings.add(String.format("%s:%s", DORIS_FE_PORT, DORIS_FE_PORT)); + portBindings.add(String.format("%s:%s", DORIS_QUERY_PORT, DORIS_QUERY_PORT)); Review Comment: as above ########## seatunnel-e2e/seatunnel-spark-connector-v2-e2e/connector-doris-spark-e2e/src/test/java/org/apache/seatunnel/e2e/spark/v2/doris/FakeSourceToDorisIT.java: ########## @@ -0,0 +1,150 @@ +/* + * 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. + */ + +package org.apache.seatunnel.e2e.spark.v2.doris; + +import org.apache.seatunnel.e2e.spark.SparkContainer; + +import org.apache.commons.compress.utils.Lists; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.Container; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; +import org.testcontainers.lifecycle.Startables; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; + +public class FakeSourceToDorisIT extends SparkContainer { + private static final Logger LOG = LoggerFactory.getLogger(FakeSourceToDorisIT.class); + + private static final String DORIS_DRIVER = "com.mysql.cj.jdbc.Driver"; + private static final String DORIS_CONNECTION_URL = "jdbc:mysql://localhost:9030?rewriteBatchedStatements=true"; + private static final String DORIS_PASSWD = ""; + private static final String DORIS_USERNAME = "root"; + + private static final String DORIS_DATABASE = "test"; + private static final String DORIS_TABLE = "seatunnel"; + private static final String DORIS_DATABASE_DDL = "CREATE DATABASE IF NOT EXISTS `" + DORIS_DATABASE + "`"; + private static final String DORIS_USE_DATABASE = "USE `" + DORIS_DATABASE + "`"; + private static final String DORIS_TABLE_DDL = "CREATE TABLE IF NOT EXISTS `" + DORIS_DATABASE + "`.`" + DORIS_TABLE + "` ( " + + " `user_id` LARGEINT NOT NULL COMMENT 'id'," + + " `city` VARCHAR(20) COMMENT 'city'," + + " `age` SMALLINT COMMENT 'age'," + + " `sex` TINYINT COMMENT 'sec'," + + " `cost` BIGINT SUM DEFAULT '0' ," + + " `max_dwell_time` INT MAX DEFAULT '0' ," + + " `min_dwell_time` INT MIN DEFAULT '99999'" + + ") AGGREGATE KEY(`user_id`, `city`, `age`, `sex`) DISTRIBUTED BY HASH(`user_id`) BUCKETS 1 PROPERTIES (" + + " 'replication_allocation' = 'tag.location.default: 1'" + + ");"; + + private static final String DORIS_TABLE_TRUNCATE_TABLE = "TRUNCATE TABLE `" + DORIS_TABLE + "`"; + private static final String DORIS_SELECT_TABLE = "SELECT COUNT(*) FROM `" + DORIS_TABLE + "`"; + + //thanks zhaomin1432 provided the doris images. + private static final String DORIS_IMAGE_NAME = "zhaomin1423/doris:1.0.0-b2"; + private static final int DORIS_FE_PORT = 8030; + private static final int DORIS_QUERY_PORT = 8040; + private static final int DORIS_BE_PORT = 9030; + + private GenericContainer<?> dorisStandaloneServer; + private Connection connection; + + @BeforeEach + public void beforeInDoris() throws InterruptedException { + super.before(); + dorisStandaloneServer = new GenericContainer<>(DORIS_IMAGE_NAME) + .withNetwork(NETWORK) + .withNetworkAliases("seatunnel-doris-network") + .withLogConsumer(new Slf4jLogConsumer(LOG)); + List<String> portBindings = Lists.newArrayList(); + portBindings.add(String.format("%s:%s", DORIS_FE_PORT, DORIS_FE_PORT)); + portBindings.add(String.format("%s:%s", DORIS_QUERY_PORT, DORIS_QUERY_PORT)); + portBindings.add(String.format("%s:%s", DORIS_BE_PORT, DORIS_BE_PORT)); + dorisStandaloneServer.setPortBindings(portBindings); + Startables.deepStart(Stream.of(dorisStandaloneServer)).join(); + Thread.sleep(TimeUnit.MINUTES.toMillis(1)); + dorisStandaloneServer.waitingFor(new HostPortWaitStrategy()); + LOG.info("Doris frontend endpoint and backend endpoint started."); + initializeDoris(); Review Comment: as above ########## seatunnel-e2e/seatunnel-flink-connector-v2-e2e/connector-flink-e2e-base/src/test/resources/log4j.properties: ########## @@ -0,0 +1,22 @@ +# Review Comment: move this file to `connector-doris-flink-e2e` module? reference https://github.com/apache/incubator-seatunnel/tree/dev/seatunnel-e2e/seatunnel-flink-connector-v2-e2e/connector-jdbc-flink-e2e/src/test/resources ########## seatunnel-e2e/seatunnel-flink-connector-v2-e2e/connector-doris-flink-e2e/src/test/java/org/apache/seatunnel/e2e/flink/v2/doris/FakeSourceToDorisIT.java: ########## @@ -0,0 +1,151 @@ +/* + * 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. + */ + +package org.apache.seatunnel.e2e.flink.v2.doris; + +import org.apache.seatunnel.e2e.flink.FlinkContainer; + +import com.google.common.collect.Lists; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.Container; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; +import org.testcontainers.lifecycle.Startables; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; + +public class FakeSourceToDorisIT extends FlinkContainer { + private static final Logger LOG = LoggerFactory.getLogger(FakeSourceToDorisIT.class); + + private static final String DORIS_DRIVER = "com.mysql.cj.jdbc.Driver"; + private static final String DORIS_CONNECTION_URL = "jdbc:mysql://localhost:9030?rewriteBatchedStatements=true"; + private static final String DORIS_PASSWD = ""; + private static final String DORIS_USERNAME = "root"; + + private static final String DORIS_DATABASE = "test"; + private static final String DORIS_TABLE = "seatunnel"; + private static final String DORIS_DATABASE_DDL = "CREATE DATABASE IF NOT EXISTS `" + DORIS_DATABASE + "`"; + private static final String DORIS_USE_DATABASE = "USE `" + DORIS_DATABASE + "`"; + private static final String DORIS_TABLE_DDL = "CREATE TABLE IF NOT EXISTS `" + DORIS_DATABASE + "`.`" + DORIS_TABLE + "` ( " + + " `user_id` LARGEINT NOT NULL COMMENT 'id'," + + " `date` DATE NOT NULL COMMENT 'date'," + + " `city` VARCHAR(20) COMMENT 'city'," + + " `age` SMALLINT COMMENT 'age'," + + " `sex` TINYINT COMMENT 'sec'," + + " `last_visit_date` DATETIME REPLACE DEFAULT '1970-01-01 00:00:00' ," + + " `cost` BIGINT SUM DEFAULT '0' ," + + " `max_dwell_time` INT MAX DEFAULT '0' ," + + " `min_dwell_time` INT MIN DEFAULT '99999'" + + ") AGGREGATE KEY(`user_id`, `date`, `city`, `age`, `sex`) DISTRIBUTED BY HASH(`user_id`) BUCKETS 1 PROPERTIES (" + + " 'replication_allocation' = 'tag.location.default: 1'" + + ");"; + + private static final String DORIS_TRUNCATE_TABLE = "TRUNCATE TABLE `" + DORIS_TABLE + "`"; + private static final String DORIS_SELECT_TABLE = "SELECT COUNT(*) FROM `" + DORIS_TABLE + "`"; + + //thanks zhaomin1432 provided the doris images. + private static final String DORIS_IMAGE_NAME = "zhaomin1423/doris:1.0.0-b2"; + private static final int DORIS_FE_PORT = 8030; + private static final int DORIS_QUERY_PORT = 8040; + private static final int DORIS_BE_PORT = 9030; + + private GenericContainer<?> dorisStandaloneServer; + private Connection connection; + + @BeforeEach + public void beforeEach() throws InterruptedException { + dorisStandaloneServer = new GenericContainer<>(DORIS_IMAGE_NAME) + .withNetwork(NETWORK) + .withNetworkAliases("seatunnel-doris-network") + .withLogConsumer(new Slf4jLogConsumer(LOG)); + List<String> portBindings = Lists.newArrayList(); + portBindings.add(String.format("%s:%s", DORIS_FE_PORT, DORIS_FE_PORT)); + portBindings.add(String.format("%s:%s", DORIS_QUERY_PORT, DORIS_QUERY_PORT)); + portBindings.add(String.format("%s:%s", DORIS_BE_PORT, DORIS_BE_PORT)); + dorisStandaloneServer.setPortBindings(portBindings); + Startables.deepStart(Stream.of(dorisStandaloneServer)).join(); + Thread.sleep(TimeUnit.MINUTES.toMillis(1)); + dorisStandaloneServer.waitingFor(new HostPortWaitStrategy()); + LOG.info("Doris frontend endpoint and backend endpoint started."); + initializeDoris(); Review Comment: Use awaitility framework? reference #2677 ########## seatunnel-e2e/seatunnel-flink-connector-v2-e2e/connector-doris-flink-e2e/src/test/java/org/apache/seatunnel/e2e/flink/v2/doris/FakeSourceToDorisIT.java: ########## @@ -0,0 +1,151 @@ +/* + * 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. + */ + +package org.apache.seatunnel.e2e.flink.v2.doris; + +import org.apache.seatunnel.e2e.flink.FlinkContainer; + +import com.google.common.collect.Lists; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.Container; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; +import org.testcontainers.lifecycle.Startables; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; + +public class FakeSourceToDorisIT extends FlinkContainer { + private static final Logger LOG = LoggerFactory.getLogger(FakeSourceToDorisIT.class); + + private static final String DORIS_DRIVER = "com.mysql.cj.jdbc.Driver"; + private static final String DORIS_CONNECTION_URL = "jdbc:mysql://localhost:9030?rewriteBatchedStatements=true"; + private static final String DORIS_PASSWD = ""; + private static final String DORIS_USERNAME = "root"; + + private static final String DORIS_DATABASE = "test"; + private static final String DORIS_TABLE = "seatunnel"; + private static final String DORIS_DATABASE_DDL = "CREATE DATABASE IF NOT EXISTS `" + DORIS_DATABASE + "`"; + private static final String DORIS_USE_DATABASE = "USE `" + DORIS_DATABASE + "`"; + private static final String DORIS_TABLE_DDL = "CREATE TABLE IF NOT EXISTS `" + DORIS_DATABASE + "`.`" + DORIS_TABLE + "` ( " + + " `user_id` LARGEINT NOT NULL COMMENT 'id'," + + " `date` DATE NOT NULL COMMENT 'date'," + + " `city` VARCHAR(20) COMMENT 'city'," + + " `age` SMALLINT COMMENT 'age'," + + " `sex` TINYINT COMMENT 'sec'," + + " `last_visit_date` DATETIME REPLACE DEFAULT '1970-01-01 00:00:00' ," + + " `cost` BIGINT SUM DEFAULT '0' ," + + " `max_dwell_time` INT MAX DEFAULT '0' ," + + " `min_dwell_time` INT MIN DEFAULT '99999'" + + ") AGGREGATE KEY(`user_id`, `date`, `city`, `age`, `sex`) DISTRIBUTED BY HASH(`user_id`) BUCKETS 1 PROPERTIES (" + + " 'replication_allocation' = 'tag.location.default: 1'" + + ");"; + + private static final String DORIS_TRUNCATE_TABLE = "TRUNCATE TABLE `" + DORIS_TABLE + "`"; + private static final String DORIS_SELECT_TABLE = "SELECT COUNT(*) FROM `" + DORIS_TABLE + "`"; + + //thanks zhaomin1432 provided the doris images. + private static final String DORIS_IMAGE_NAME = "zhaomin1423/doris:1.0.0-b2"; + private static final int DORIS_FE_PORT = 8030; + private static final int DORIS_QUERY_PORT = 8040; + private static final int DORIS_BE_PORT = 9030; + + private GenericContainer<?> dorisStandaloneServer; + private Connection connection; + + @BeforeEach + public void beforeEach() throws InterruptedException { + dorisStandaloneServer = new GenericContainer<>(DORIS_IMAGE_NAME) + .withNetwork(NETWORK) + .withNetworkAliases("seatunnel-doris-network") + .withLogConsumer(new Slf4jLogConsumer(LOG)); + List<String> portBindings = Lists.newArrayList(); + portBindings.add(String.format("%s:%s", DORIS_FE_PORT, DORIS_FE_PORT)); + portBindings.add(String.format("%s:%s", DORIS_QUERY_PORT, DORIS_QUERY_PORT)); Review Comment: unused? ########## seatunnel-e2e/seatunnel-flink-connector-v2-e2e/connector-doris-flink-e2e/src/test/java/org/apache/seatunnel/e2e/flink/v2/doris/FakeSourceToDorisIT.java: ########## @@ -0,0 +1,151 @@ +/* + * 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. + */ + +package org.apache.seatunnel.e2e.flink.v2.doris; + +import org.apache.seatunnel.e2e.flink.FlinkContainer; + +import com.google.common.collect.Lists; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.Container; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; +import org.testcontainers.lifecycle.Startables; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; + +public class FakeSourceToDorisIT extends FlinkContainer { + private static final Logger LOG = LoggerFactory.getLogger(FakeSourceToDorisIT.class); + + private static final String DORIS_DRIVER = "com.mysql.cj.jdbc.Driver"; + private static final String DORIS_CONNECTION_URL = "jdbc:mysql://localhost:9030?rewriteBatchedStatements=true"; + private static final String DORIS_PASSWD = ""; + private static final String DORIS_USERNAME = "root"; + + private static final String DORIS_DATABASE = "test"; + private static final String DORIS_TABLE = "seatunnel"; + private static final String DORIS_DATABASE_DDL = "CREATE DATABASE IF NOT EXISTS `" + DORIS_DATABASE + "`"; + private static final String DORIS_USE_DATABASE = "USE `" + DORIS_DATABASE + "`"; + private static final String DORIS_TABLE_DDL = "CREATE TABLE IF NOT EXISTS `" + DORIS_DATABASE + "`.`" + DORIS_TABLE + "` ( " + + " `user_id` LARGEINT NOT NULL COMMENT 'id'," + + " `date` DATE NOT NULL COMMENT 'date'," + + " `city` VARCHAR(20) COMMENT 'city'," + + " `age` SMALLINT COMMENT 'age'," + + " `sex` TINYINT COMMENT 'sec'," + + " `last_visit_date` DATETIME REPLACE DEFAULT '1970-01-01 00:00:00' ," + + " `cost` BIGINT SUM DEFAULT '0' ," + + " `max_dwell_time` INT MAX DEFAULT '0' ," + + " `min_dwell_time` INT MIN DEFAULT '99999'" + + ") AGGREGATE KEY(`user_id`, `date`, `city`, `age`, `sex`) DISTRIBUTED BY HASH(`user_id`) BUCKETS 1 PROPERTIES (" + + " 'replication_allocation' = 'tag.location.default: 1'" + + ");"; + + private static final String DORIS_TRUNCATE_TABLE = "TRUNCATE TABLE `" + DORIS_TABLE + "`"; + private static final String DORIS_SELECT_TABLE = "SELECT COUNT(*) FROM `" + DORIS_TABLE + "`"; + + //thanks zhaomin1432 provided the doris images. + private static final String DORIS_IMAGE_NAME = "zhaomin1423/doris:1.0.0-b2"; Review Comment: why not use `apache/doris` image? ########## seatunnel-e2e/seatunnel-flink-connector-v2-e2e/connector-doris-flink-e2e/src/test/resources/doris/fakesource_to_doris.conf: ########## @@ -0,0 +1,73 @@ +# +# 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. +# +###### +###### This config file is a demonstration of streaming processing in seatunnel config +###### + +env { + # You can set flink configuration here + execution.parallelism = 1 + job.mode = "BATCH" + #execution.checkpoint.interval = 10000 + #execution.checkpoint.data-uri = "hdfs://localhost:9000/checkpoint" +} + +source { + # This is a example source plugin **only for test and demonstrate the feature source plugin** + FakeSource { + result_table_name = "fake" + schema = { + fields { + user_id = "bigint", + date = "date", + city = "string", + age = "smallint", + sex = "smallint", + last_visit_date = "timestamp", + cost = "bigint", + max_dwell_time = "int", + min_dwell_time = "int", + price = "double" Review Comment: test all datatype? reference https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-e2e/seatunnel-flink-connector-v2-e2e/connector-mongodb-flink-e2e/src/test/resources/mongodb/fake_to_mongodb.conf#L37 ########## seatunnel-e2e/seatunnel-spark-connector-v2-e2e/connector-doris-spark-e2e/src/test/java/org/apache/seatunnel/e2e/spark/v2/doris/FakeSourceToDorisIT.java: ########## @@ -0,0 +1,150 @@ +/* + * 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. + */ + +package org.apache.seatunnel.e2e.spark.v2.doris; + +import org.apache.seatunnel.e2e.spark.SparkContainer; + +import org.apache.commons.compress.utils.Lists; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.Container; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; +import org.testcontainers.lifecycle.Startables; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; + +public class FakeSourceToDorisIT extends SparkContainer { + private static final Logger LOG = LoggerFactory.getLogger(FakeSourceToDorisIT.class); + + private static final String DORIS_DRIVER = "com.mysql.cj.jdbc.Driver"; + private static final String DORIS_CONNECTION_URL = "jdbc:mysql://localhost:9030?rewriteBatchedStatements=true"; + private static final String DORIS_PASSWD = ""; + private static final String DORIS_USERNAME = "root"; + + private static final String DORIS_DATABASE = "test"; + private static final String DORIS_TABLE = "seatunnel"; + private static final String DORIS_DATABASE_DDL = "CREATE DATABASE IF NOT EXISTS `" + DORIS_DATABASE + "`"; + private static final String DORIS_USE_DATABASE = "USE `" + DORIS_DATABASE + "`"; + private static final String DORIS_TABLE_DDL = "CREATE TABLE IF NOT EXISTS `" + DORIS_DATABASE + "`.`" + DORIS_TABLE + "` ( " + + " `user_id` LARGEINT NOT NULL COMMENT 'id'," + + " `city` VARCHAR(20) COMMENT 'city'," + + " `age` SMALLINT COMMENT 'age'," + + " `sex` TINYINT COMMENT 'sec'," + + " `cost` BIGINT SUM DEFAULT '0' ," + + " `max_dwell_time` INT MAX DEFAULT '0' ," + + " `min_dwell_time` INT MIN DEFAULT '99999'" + + ") AGGREGATE KEY(`user_id`, `city`, `age`, `sex`) DISTRIBUTED BY HASH(`user_id`) BUCKETS 1 PROPERTIES (" + + " 'replication_allocation' = 'tag.location.default: 1'" + + ");"; + + private static final String DORIS_TABLE_TRUNCATE_TABLE = "TRUNCATE TABLE `" + DORIS_TABLE + "`"; + private static final String DORIS_SELECT_TABLE = "SELECT COUNT(*) FROM `" + DORIS_TABLE + "`"; + + //thanks zhaomin1432 provided the doris images. + private static final String DORIS_IMAGE_NAME = "zhaomin1423/doris:1.0.0-b2"; Review Comment: as above ########## seatunnel-e2e/seatunnel-spark-connector-v2-e2e/connector-doris-spark-e2e/src/test/resources/doris/fakesource_to_doris.conf: ########## @@ -0,0 +1,75 @@ +# +# 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. +# +###### +###### This config file is a demonstration of streaming processing in seatunnel config +###### + +env { + # You can set flink configuration here + job.mode = "BATCH" + spark.app.name = "SeaTunnel" + spark.executor.instances = 2 + spark.executor.cores = 1 + spark.executor.memory = "1g" + spark.master = local + #execution.checkpoint.interval = 10000 + #execution.checkpoint.data-uri = "hdfs://localhost:9000/checkpoint" +} + +source { + # This is a example source plugin **only for test and demonstrate the feature source plugin** + FakeSource { + result_table_name = "fake" + schema = { + fields { + user_id = "bigint", + city = "string", + age = "smallint", + sex = "smallint", + cost = "bigint", + max_dwell_time = "int", + min_dwell_time = "int", + price = "double" Review Comment: as above -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
