Skip to content

Commit 2036499

Browse files
author
yangemngqi
committed
add test case
1 parent b32a7d7 commit 2036499

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/java/org/apache/seatunnel/e2e/connector/doris/DorisIT.java

+32
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
import org.apache.seatunnel.common.utils.JsonUtils;
2323
import org.apache.seatunnel.connectors.doris.util.DorisCatalogUtil;
2424
import org.apache.seatunnel.e2e.common.container.ContainerExtendedFactory;
25+
import org.apache.seatunnel.e2e.common.container.EngineType;
2526
import org.apache.seatunnel.e2e.common.container.TestContainer;
27+
import org.apache.seatunnel.e2e.common.junit.DisabledOnContainer;
2628
import org.apache.seatunnel.e2e.common.junit.TestContainerExtension;
2729

2830
import org.junit.jupiter.api.AfterAll;
@@ -781,4 +783,34 @@ public void getErrorUrl(String message) {
781783
log.error(ExceptionUtils.getMessage(e));
782784
}
783785
}
786+
787+
@TestTemplate
788+
@DisabledOnContainer(
789+
value = {},
790+
type = {EngineType.SPARK, EngineType.FLINK},
791+
disabledReason = "not need to use flink/spark")
792+
public void testDorisFieldArray(TestContainer container) throws IOException, InterruptedException {
793+
initializeJdbcTable();
794+
insertDuplicateTableData();
795+
Container.ExecResult execResult =
796+
container.executeJob("/doris_source_field_array_and_sink_console.conf");
797+
Assertions.assertTrue(execResult.getStderr().contains("Index: 0, Size: 0"));
798+
}
799+
800+
private void insertDuplicateTableData() {
801+
try {
802+
PreparedStatement pstmt = conn.prepareStatement("INSERT INTO " + sourceDB + "." + DUPLICATE_TABLE + " (" +
803+
"F_ID, F_INT, F_BIGINT, F_TINYINT, F_SMALLINT, F_DECIMAL, F_DECIMAL_V3, F_LARGEINT, F_BOOLEAN, F_DOUBLE, F_FLOAT, F_CHAR, F_VARCHAR_11, F_STRING, F_DATETIME_P, F_DATETIME_V2, F_DATETIME, F_DATE, F_DATE_V2, F_JSON, F_JSONB, F_ARRAY_BOOLEAN, F_ARRAY_BYTE, F_ARRAY_SHOT, F_ARRAY_INT, F_ARRAY_BIGINT, F_ARRAY_FLOAT, F_ARRAY_DOUBLE, F_ARRAY_STRING_CHAR, F_ARRAY_STRING_VARCHAR, F_ARRAY_STRING_LARGEINT, F_ARRAY_STRING_STRING, F_ARRAY_DECIMAL, F_ARRAY_DATE, F_ARRAY_DATETIME" +
804+
") VALUES " +
805+
"('1', 123, 4567890123456789, 1, 12345, 123.45, 678.90, 1234567890123456789, TRUE, 123.456, 78.90, 'A', 'varchar11', 'random_string', '2023-01-01 12:00:00', '2023-01-01 12:00:00', '2023-01-01 12:00:00', '2023-01-01', '2023-01-01', '{\"key\": \"value\"}', '{\"key\": \"value\"}', '{true, false}', '{1, 2, 3}', '{1, 2, 3}', '{1, 2, 3}', '{1234567890123456789}', '{1.23, 4.56}', '{7.89, 0.12}', '{char1, char2}', '[]', '{largeint1, largeint2}', '{string1, string2}', '{123.45, 678.90}', '{2023-01-01}', '{2023-01-01 12:00:00}'), " +
806+
"('2', 234, 5678901234567890, 2, 23456, 234.56, 789.01, 2345678901234567890, FALSE, 234.567, 89.01, 'B', 'varchar12', 'random_string', '2023-02-02 13:00:00', '2023-02-02 13:00:00', '2023-02-02 13:00:00', '2023-02-02', '2023-02-02', '{\"key\": \"value\"}', '{\"key\": \"value\"}', '{false, true}', '{4, 5, 6}', '{4, 5, 6}', '{4, 5, 6}', '{2345678901234567890}', '{2.34, 5.67}', '{8.90, 1.23}', '{char3, char4}', '[]', '{largeint3, largeint4}', '{string3, string4}', '{234.56, 789.01}', '{2023-02-02}', '{2023-02-02 13:00:00}'), " +
807+
"('3', 345, 6789012345678901, 3, 34567, 345.67, 890.12, 3456789012345678901, TRUE, 345.678, 90.12, 'C', 'varchar13', 'random_string', '2023-03-03 14:00:00', '2023-03-03 14:00:00', '2023-03-03 14:00:00', '2023-03-03', '2023-03-03', '{\"key\": \"value\"}', '{\"key\": \"value\"}', '{true, true}', '{7, 8, 9}', '{7, 8, 9}', '{7, 8, 9}', '{3456789012345678901}', '{3.45, 6.78}', '{9.01, 2.34}', '{char5, char6}', '[]', '{largeint5, largeint6}', '{string5, string6}', '{345.67, 890.12}', '{2023-03-03}', '{2023-03-03 14:00:00}'), " +
808+
"('4', 456, 7890123456789012, 4, 45678, 456.78, 901.23, 4567890123456789012, FALSE, 456.789, 12.34, 'D', 'varchar14', 'random_string', '2023-04-04 15:00:00', '2023-04-04 15:00:00', '2023-04-04 15:00:00', '2023-04-04', '2023-04-04', '{\"key\": \"value\"}', '{\"key\": \"value\"}', '{false, false}', '{10, 11, 12}', '{10, 11, 12}', '{10, 11, 12}', '{4567890123456789012}', '{4.56, 7.89}', '{0.12, 3.45}', '{char7, char8}', '[]', '{largeint7, largeint8}', '{string7, string8}', '{456.78, 901.23}', '{2023-04-04}', '{2023-04-04 15:00:00}'), " +
809+
"('5', 567, 8901234567890123, 5, 56789, 567.89, 12.34, 5678901234567890123, TRUE, 567.890, 23.45, 'E', 'varchar15', 'random_string', '2023-05-05 16:00:00', '2023-05-05 16:00:00', '2023-05-05 16:00:00', '2023-05-05', '2023-05-05', '{\"key\": \"value\"}', '{\"key\": \"value\"}', '{true, false}', '{13, 14, 15}', '{13, 14, 15}', '{13, 14, 15}', '{5678901234567890123}', '{5.67, 8.90}', '{1.23, 4.56}', '{char9, char10}', '[]', '{largeint9, largeint10}', '{string9, string10}', '{567.89, 12.34}', '{2023-05-05}', '{2023-05-05 16:00:00}')");
810+
int affectedRows = pstmt.executeUpdate();
811+
System.out.println(affectedRows);
812+
} catch (Exception e) {
813+
throw new RuntimeException("Create rows failed!", e);
814+
}
815+
}
784816
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
env {
19+
parallelism = 1
20+
job.mode = BATCH
21+
}
22+
23+
source {
24+
Doris {
25+
fenodes = "doris_e2e:8030"
26+
username = root
27+
password = ""
28+
database = "e2e_source"
29+
table = "doris_duplicate_table"
30+
doris.read.field = "F_ID, F_INT, F_BIGINT, F_TINYINT, F_SMALLINT, F_DECIMAL, F_DECIMAL_V3, F_LARGEINT, F_BOOLEAN, F_DOUBLE, F_FLOAT, F_CHAR, F_VARCHAR_11, F_STRING, F_DATETIME_P, F_DATETIME_V2, F_DATETIME, F_DATE, F_DATE_V2, F_JSON, F_JSONB, F_ARRAY_BOOLEAN, F_ARRAY_BYTE, F_ARRAY_SHOT, F_ARRAY_INT, F_ARRAY_BIGINT, F_ARRAY_FLOAT, F_ARRAY_DOUBLE, F_ARRAY_STRING_CHAR, F_ARRAY_STRING_VARCHAR, F_ARRAY_STRING_LARGEINT, F_ARRAY_STRING_STRING, F_ARRAY_DECIMAL, F_ARRAY_DATE, F_ARRAY_DATETIME"
31+
}
32+
}
33+
transform {
34+
}
35+
sink {
36+
Console {}
37+
}

0 commit comments

Comments
 (0)