TyrantLucifer commented on code in PR #4620:
URL:
https://github.com/apache/incubator-seatunnel/pull/4620#discussion_r1172049883
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-mongodb-e2e/src/test/java/org/apache/seatunnel/e2e/connector/v2/mongodb/MongodbIT.java:
##########
@@ -71,13 +62,23 @@ public class MongodbIT extends TestSuiteBase implements
TestResource {
private static final String MONGODB_CONTAINER_HOST = "e2e_mongodb";
private static final int MONGODB_PORT = 27017;
private static final String MONGODB_DATABASE = "test_db";
- private static final String MONGODB_SOURCE_TABLE = "source_table";
- private static final List<Document> TEST_DATASET = generateTestDataSet(0,
10);
+ private static final String MONGODB_SOURCE_TABLE = "test_match_op_db";
private GenericContainer<?> mongodbContainer;
private MongoClient client;
+ private static final Random random = new Random();
Review Comment:
static parameter should on the top.
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-mongodb-e2e/src/test/resources/mongodb_matchProjection_source_to_assert.conf:
##########
@@ -0,0 +1,99 @@
+#
+# 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 {
+ execution.parallelism = 1
+ job.mode = "BATCH"
+ #spark config
+ spark.app.name = "SeaTunnel"
+ spark.executor.instances = 1
+ spark.executor.cores = 1
+ spark.executor.memory = "1g"
+ spark.master = local
+}
+
+source {
+ Mongodb {
+ connection = "mongodb://e2e_mongodb:27017/test_db?retryWrites=true"
+ database = "test_db"
+ collection = "sink_table"
+ match.projection = "{ c_bigint:0 }"
+ result_table_name = "mongodb_table"
+ no-timeout = true
+ fetch.size = 1000
+ max.time.min = 100
+ schema = {
+ fields {
+ c_map = "map<string, string>"
+ c_array = "array<int>"
+ c_string = string
+ c_boolean = boolean
+ c_tinyint = int
+ c_smallint = int
+ c_int = int
+ c_float = double
+ c_double = double
+ c_bytes = bytes
+ c_date = date
+ c_decimal = "decimal(33, 18)"
+ c_timestamp = timestamp
+ c_row = {
+ c_map = "map<string, string>"
+ c_array = "array<int>"
+ c_string = string
+ c_boolean = boolean
+ c_tinyint = int
+ c_smallint = int
+ c_int = int
+ c_bigint = bigint
+ c_float = double
+ c_double = double
+ c_bytes = bytes
+ c_date = date
+ c_decimal = "decimal(33, 18)"
+ c_timestamp = timestamp
+ }
+ }
+ }
+ }
+}
+
+
+sink {
+ Console {
+ source_table_name = "mongodb_table"
+ }
+ Assert {
+ source_table_name = "mongodb_table"
+ rules =
+ {
+ row_rules = [
+ {
Review Comment:
Add more check rules.
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-mongodb-e2e/src/test/resources/mongodb_source_to_assert.conf:
##########
@@ -19,55 +19,81 @@
######
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"
+ #spark config
+ spark.app.name = "SeaTunnel"
+ spark.executor.instances = 1
+ spark.executor.cores = 1
+ spark.executor.memory = "1g"
+ spark.master = local
}
source {
- MongoDB {
- uri =
"mongodb://e2e_mongodb:27017/test_db?retryWrites=true&writeConcern=majority"
+ Mongodb {
+ connection = "mongodb://e2e_mongodb:27017/test_db?retryWrites=true"
database = "test_db"
- collection = "source_table"
+ collection = "sink_table"
+ no-timeout = true
+ fetch.size = 1000
+ max.time.min = 100
+ result_table_name = "mongodb_table"
schema = {
fields {
- id = bigint
- c_map = "map<string, smallint>"
- c_array = "array<tinyint>"
+ c_map = "map<string, string>"
+ c_array = "array<int>"
c_string = string
c_boolean = boolean
- c_tinyint = tinyint
- c_smallint = smallint
+ c_tinyint = int
Review Comment:
Why change it? Connector should support all type that SeaTunnel has defined,
although mongo does not distinguish, you should and convert logic in your
connector.
--
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]