zhangshenghang commented on code in PR #9872:
URL: https://github.com/apache/seatunnel/pull/9872#discussion_r2385672400


##########
seatunnel-connectors-v2/connector-iotdb-v2/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdbv2/source/relational/IoTDBv2RelationalSourceReader.java:
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.seatunnel.iotdbv2.source.relational;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.source.Collector;
+import org.apache.seatunnel.api.source.SourceReader;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.constant.SourceConstants;
+import 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.exception.IotdbConnectorErrorCode;
+import 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.exception.IotdbConnectorException;
+import 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.serialize.DefaultSeaTunnelRowDeserializer;
+import 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.source.IoTDBv2AbstractSourceReader;
+import 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.source.IoTDBv2SourceSplit;
+
+import shaded.org.apache.iotdb.isession.ITableSession;
+import shaded.org.apache.iotdb.isession.SessionDataSet;
+import shaded.org.apache.iotdb.rpc.IoTDBConnectionException;
+import shaded.org.apache.iotdb.session.TableSessionBuilder;
+import shaded.org.apache.tsfile.read.common.RowRecord;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.config.IoTDBv2SourceOptions.DATABASE;
+import static 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.config.IoTDBv2SourceOptions.DEFAULT_THRIFT_BUFFER_SIZE;
+import static 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.config.IoTDBv2SourceOptions.FETCH_SIZE;
+import static 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.config.IoTDBv2SourceOptions.MAX_THRIFT_FRAME_SIZE;
+import static 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.config.IoTDBv2SourceOptions.NODE_URLS;
+import static 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.config.IoTDBv2SourceOptions.PASSWORD;
+import static 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.config.IoTDBv2SourceOptions.USERNAME;
+import static 
org.apache.seatunnel.connectors.seatunnel.iotdbv2.constant.SourceConstants.NODES_SPLIT;
+
+public class IoTDBv2RelationalSourceReader extends IoTDBv2AbstractSourceReader 
{
+
+    private ITableSession tableSession;
+
+    public IoTDBv2RelationalSourceReader(
+            ReadonlyConfig conf, SourceReader.Context readerContext, 
SeaTunnelRowType rowType) {
+        super(conf, readerContext);
+        this.deserializer = new DefaultSeaTunnelRowDeserializer(rowType, 
SourceConstants.TABLE);
+    }
+
+    @Override
+    public void open() throws Exception {
+        tableSession = buildTableSession(conf);
+    }
+
+    @Override
+    public void close() throws IOException {
+        try {
+            if (tableSession != null) {
+                tableSession.close();
+            }
+        } catch (IoTDBConnectionException e) {
+            throw new IotdbConnectorException(
+                    IotdbConnectorErrorCode.CLOSE_SESSION_FAILED, "Close IoTDB 
session failed", e);
+        }
+    }
+
+    private ITableSession buildTableSession(ReadonlyConfig conf) throws 
IoTDBConnectionException {
+        TableSessionBuilder sessionBuilder = new 
TableSessionBuilder().enableCompression(false);
+        String nodeUrlsString = conf.get(NODE_URLS);

Review Comment:
   It should not be String; it should be List<String>



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