chuang-wang-pre commented on code in PR #73: URL: https://github.com/apache/doris-kafka-connector/pull/73#discussion_r2080993360
########## src/main/java/org/apache/doris/kafka/connector/service/DorisCombinedSinkService.java: ########## @@ -0,0 +1,143 @@ +/* + * 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.doris.kafka.connector.service; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import org.apache.doris.kafka.connector.writer.DorisWriter; +import org.apache.doris.kafka.connector.writer.StreamLoadWriter; +import org.apache.kafka.clients.consumer.OffsetAndMetadata; +import org.apache.kafka.common.TopicPartition; +import org.apache.kafka.connect.sink.SinkRecord; +import org.apache.kafka.connect.sink.SinkTaskContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** Combined all partitions and write once. */ +public class DorisCombinedSinkService extends DorisDefaultSinkService { + private static final Logger LOG = LoggerFactory.getLogger(DorisCombinedSinkService.class); + + private final Map<String, HashMap<Integer, Long>> topicPartitionOffset; + + DorisCombinedSinkService(Map<String, String> config, SinkTaskContext context) { + super(config, context); + this.topicPartitionOffset = new HashMap<>(); + } + + /** + * Create new task + * + * @param tableName destination table name in doris + * @param topicPartition TopicPartition passed from Kafka + */ + @Override + public void startTask(final String tableName, final TopicPartition topicPartition) { + // check if the task is already started + String writerKey = getWriterKey(topicPartition.topic(), tableName); + if (writer.containsKey(writerKey)) { + LOG.info("already start task with key {}", writerKey); + } else { + String topic = topicPartition.topic(); + + // Only by topic + int partition = -1; + DorisWriter dorisWriter = + new StreamLoadWriter( Review Comment: the 'copy_into' load model is need support? -- 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: dev-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@doris.apache.org For additional commands, e-mail: dev-h...@doris.apache.org