EricJoy2048 commented on code in PR #6161:
URL: https://github.com/apache/seatunnel/pull/6161#discussion_r1447056433


##########
seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/backend/BackendClient.java:
##########
@@ -0,0 +1,264 @@
+/*
+ * 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.connectors.doris.backend;
+
+import org.apache.seatunnel.shade.org.apache.thrift.TConfiguration;
+import org.apache.seatunnel.shade.org.apache.thrift.TException;
+import org.apache.seatunnel.shade.org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.seatunnel.shade.org.apache.thrift.protocol.TProtocol;
+import org.apache.seatunnel.shade.org.apache.thrift.transport.TSocket;
+import org.apache.seatunnel.shade.org.apache.thrift.transport.TTransport;
+import 
org.apache.seatunnel.shade.org.apache.thrift.transport.TTransportException;
+
+import org.apache.seatunnel.connectors.doris.config.DorisConfig;
+import org.apache.seatunnel.connectors.doris.config.DorisOptions;
+import org.apache.seatunnel.connectors.doris.exception.DorisConnectorErrorCode;
+import org.apache.seatunnel.connectors.doris.exception.DorisConnectorException;
+import org.apache.seatunnel.connectors.doris.source.serialization.Routing;
+import org.apache.seatunnel.connectors.doris.util.ErrorMessages;
+
+import org.apache.doris.sdk.thrift.TDorisExternalService;
+import org.apache.doris.sdk.thrift.TScanBatchResult;
+import org.apache.doris.sdk.thrift.TScanCloseParams;
+import org.apache.doris.sdk.thrift.TScanCloseResult;
+import org.apache.doris.sdk.thrift.TScanNextBatchParams;
+import org.apache.doris.sdk.thrift.TScanOpenParams;
+import org.apache.doris.sdk.thrift.TScanOpenResult;
+import org.apache.doris.sdk.thrift.TStatusCode;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class BackendClient {
+
+    private Routing routing;
+
+    private TDorisExternalService.Client client;
+    private TTransport transport;
+
+    private boolean isConnected = false;
+    private final int retries;
+    private final int socketTimeout;
+    private final int connectTimeout;
+
+    public BackendClient(Routing routing, DorisConfig readOptions) {
+        this.routing = routing;
+        this.connectTimeout =
+                readOptions.getRequestConnectTimeoutMs() == null
+                        ? DorisOptions.DORIS_REQUEST_CONNECT_TIMEOUT_MS_DEFAULT
+                        : readOptions.getRequestConnectTimeoutMs();
+        this.socketTimeout =

Review Comment:
   same as above.



##########
seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/source/DorisSourceFactory.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * 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.connectors.doris.source;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.configuration.util.OptionRule;
+import org.apache.seatunnel.api.source.SeaTunnelSource;
+import org.apache.seatunnel.api.source.SourceSplit;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.catalog.CatalogTableUtil;
+import org.apache.seatunnel.api.table.catalog.TablePath;
+import org.apache.seatunnel.api.table.catalog.schema.TableSchemaOptions;
+import org.apache.seatunnel.api.table.connector.TableSource;
+import org.apache.seatunnel.api.table.factory.Factory;
+import org.apache.seatunnel.api.table.factory.TableSourceFactory;
+import org.apache.seatunnel.api.table.factory.TableSourceFactoryContext;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.connectors.doris.catalog.DorisCatalog;
+import org.apache.seatunnel.connectors.doris.catalog.DorisCatalogFactory;
+import org.apache.seatunnel.connectors.doris.config.DorisOptions;
+
+import com.google.auto.service.AutoService;
+
+import java.io.Serializable;
+
+@AutoService(Factory.class)
+public class DorisSourceFactory implements TableSourceFactory {
+    @Override
+    public String factoryIdentifier() {
+        return "Doris";
+    }
+
+    @Override
+    public OptionRule optionRule() {
+        return OptionRule.builder()
+                .required(
+                        DorisOptions.FENODES,
+                        DorisOptions.USERNAME,
+                        DorisOptions.PASSWORD,
+                        DorisOptions.DATABASE,
+                        DorisOptions.TABLE)
+                .optional(DorisOptions.DORIS_FILTER_QUERY)
+                .optional(DorisOptions.DORIS_READ_FIELD)

Review Comment:
   This option can not found in `Doris.md`



##########
plugin-mapping.properties:
##########
@@ -97,6 +97,7 @@ seatunnel.sink.RabbitMQ = connector-rabbitmq
 seatunnel.source.RabbitMQ = connector-rabbitmq
 seatunnel.source.OpenMldb = connector-openmldb
 seatunnel.source.SqlServer-CDC = connector-cdc-sqlserver
+seatunnel.source.Doris = connector-doris

Review Comment:
   Please add this connector to `seatunnel-dist/pom.xml`



##########
seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/backend/BackendClient.java:
##########
@@ -0,0 +1,264 @@
+/*
+ * 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.connectors.doris.backend;
+
+import org.apache.seatunnel.shade.org.apache.thrift.TConfiguration;
+import org.apache.seatunnel.shade.org.apache.thrift.TException;
+import org.apache.seatunnel.shade.org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.seatunnel.shade.org.apache.thrift.protocol.TProtocol;
+import org.apache.seatunnel.shade.org.apache.thrift.transport.TSocket;
+import org.apache.seatunnel.shade.org.apache.thrift.transport.TTransport;
+import 
org.apache.seatunnel.shade.org.apache.thrift.transport.TTransportException;
+
+import org.apache.seatunnel.connectors.doris.config.DorisConfig;
+import org.apache.seatunnel.connectors.doris.config.DorisOptions;
+import org.apache.seatunnel.connectors.doris.exception.DorisConnectorErrorCode;
+import org.apache.seatunnel.connectors.doris.exception.DorisConnectorException;
+import org.apache.seatunnel.connectors.doris.source.serialization.Routing;
+import org.apache.seatunnel.connectors.doris.util.ErrorMessages;
+
+import org.apache.doris.sdk.thrift.TDorisExternalService;
+import org.apache.doris.sdk.thrift.TScanBatchResult;
+import org.apache.doris.sdk.thrift.TScanCloseParams;
+import org.apache.doris.sdk.thrift.TScanCloseResult;
+import org.apache.doris.sdk.thrift.TScanNextBatchParams;
+import org.apache.doris.sdk.thrift.TScanOpenParams;
+import org.apache.doris.sdk.thrift.TScanOpenResult;
+import org.apache.doris.sdk.thrift.TStatusCode;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class BackendClient {
+
+    private Routing routing;
+
+    private TDorisExternalService.Client client;
+    private TTransport transport;
+
+    private boolean isConnected = false;
+    private final int retries;
+    private final int socketTimeout;
+    private final int connectTimeout;
+
+    public BackendClient(Routing routing, DorisConfig readOptions) {
+        this.routing = routing;
+        this.connectTimeout =

Review Comment:
   From `DorisConfig` we can know `readOptions.getRequestConnectTimeoutMs()` 
will never return null.
   
   DorisConfig.java
   ```
   
dorisConfig.setRequestReadTimeoutMs(config.get(DORIS_REQUEST_CONNECT_TIMEOUT_MS));
   ```
   
   ReadOnlyConfig.java
   ```
   public <T> T get(Option<T> option) {
           return getOptional(option).orElseGet(option::defaultValue);
       }
   ```



-- 
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]

Reply via email to