You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/08/13 14:48:59 UTC

[GitHub] [incubator-seatunnel] hailin0 opened a new pull request, #2407: [Feature][Connector-V2] Support IoTDB sink

hailin0 opened a new pull request, #2407:
URL: https://github.com/apache/incubator-seatunnel/pull/2407

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   Support IoTDB sink connector #1946
   
   ## Check list
   
   * [x] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] CalvinKirs merged pull request #2407: [Feature][Connector-V2] Support IoTDB sink

Posted by GitBox <gi...@apache.org>.
CalvinKirs merged PR #2407:
URL: https://github.com/apache/incubator-seatunnel/pull/2407


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] EricJoy2048 commented on pull request #2407: [Feature][Connector-V2] Support IoTDB sink

Posted by GitBox <gi...@apache.org>.
EricJoy2048 commented on PR #2407:
URL: https://github.com/apache/incubator-seatunnel/pull/2407#issuecomment-1216417433

   > Disable iotdb spark-testcase due to conflict with libthrift package
   > 
   > spark-server/lib 2.4.3: libthrift-0.9.3 spark-hive 2.4.3: libthrift-0.9.3 iotdb-session 13.1: libthrift-0.14.1
   
   It seems spark use `parent first` classload profile. So this connector can not support spark now. I suggest we add this notice to document and merge this pr.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] hailin0 commented on pull request #2407: [Feature][Connector-V2] Support IoTDB sink

Posted by GitBox <gi...@apache.org>.
hailin0 commented on PR #2407:
URL: https://github.com/apache/incubator-seatunnel/pull/2407#issuecomment-1217427485

   > > Disable iotdb spark-testcase due to conflict with libthrift package
   > > spark-server/lib 2.4.3: libthrift-0.9.3 spark-hive 2.4.3: libthrift-0.9.3 iotdb-session 13.1: libthrift-0.14.1
   > 
   > It seems spark use `parent first` classload profile. So this connector can not support spark now. I suggest we add this notice to document and merge this pr.
   
   updated


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] hailin0 commented on pull request #2407: [Feature][Connector-V2] Support IoTDB sink

Posted by GitBox <gi...@apache.org>.
hailin0 commented on PR #2407:
URL: https://github.com/apache/incubator-seatunnel/pull/2407#issuecomment-1214715883

   Disable iotdb spark-testcase due to conflict with libthrift package
   
   spark server 2.4.3: libthrift-0.9.3
   spark-hive 2.4.3: libthrift-0.9.3
   iotdb-session 13.1: libthrift-0.14.1


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] ashulin commented on a diff in pull request #2407: [Feature][Connector-V2] Support IoTDB sink

Posted by GitBox <gi...@apache.org>.
ashulin commented on code in PR #2407:
URL: https://github.com/apache/incubator-seatunnel/pull/2407#discussion_r945160268


##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/sink/IoTDBSink.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.iotdb.sink;
+
+import org.apache.seatunnel.api.common.PrepareFailException;
+import org.apache.seatunnel.api.sink.SeaTunnelSink;
+import org.apache.seatunnel.api.sink.SinkWriter;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.connectors.seatunnel.iotdb.state.IoTDBAggregatedCommitInfo;
+import org.apache.seatunnel.connectors.seatunnel.iotdb.state.IoTDBCommitInfo;
+import org.apache.seatunnel.connectors.seatunnel.iotdb.state.IoTDBSinkState;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+
+import com.google.auto.service.AutoService;
+
+import java.io.IOException;
+
+@AutoService(SeaTunnelSink.class)
+public class IoTDBSink implements SeaTunnelSink<SeaTunnelRow, IoTDBSinkState, IoTDBCommitInfo, IoTDBAggregatedCommitInfo> {

Review Comment:
   ```suggestion
   public class IoTDBSink extend AbstractSimpleSink<SeaTunnelRow, Void> {
   ```
   It's easier to implement,and you can delete actually useless classes;



##########
docs/en/connector-v2/sink/IoTDB.md:
##########
@@ -0,0 +1,111 @@
+# IoTDB
+
+> IoTDB sink connector
+
+## Description
+
+Used to write data to IoTDB. Supports Batch and Streaming mode.
+
+## Options
+
+| name                          | type              | required | default value |
+|-------------------------------|-------------------|----------|---------------|
+| node_urls                     | list              | yes      | -             |
+| username                      | string            | yes      | -             |
+| password                      | string            | yes      | -             |
+| batch_size                    | int               | no       | 1024          |
+| batch_interval_ms             | int               | no       | -             |
+| max_retries                   | int               | no       | -             |
+| retry_backoff_multiplier_ms   | int               | no       | -             |
+| max_retry_backoff_ms          | int               | no       | -             |
+| default_thrift_buffer_size    | int               | no       | -             |
+| max_thrift_frame_size         | int               | no       | -             |
+| zone_id                       | string            | no       | -             |
+| enable_rpc_compression        | boolean           | no       | -             |
+| connection_timeout_in_ms      | int               | no       | -             |
+| timeseries_options            | list              | no       | -             |
+| timeseries_options.path       | string            | no       | -             |
+| timeseries_options.data_type  | string            | no       | -             |
+| common-options                | string            | no       | -             |
+
+### node_urls [list]
+
+`IoTDB` cluster address, the format is `["host:port", ...]`
+
+### username [string]
+
+`IoTDB` user username
+
+### password [string]
+
+`IoTDB` user password
+
+### batch_size [int]
+
+For batch writing, when the number of buffers reaches the number of `batch_size` or the time reaches `batch_interval_ms`, the data will be flushed into the IoTDB
+
+### batch_interval_ms [int]
+
+For batch writing, when the number of buffers reaches the number of `batch_size` or the time reaches `batch_interval_ms`, the data will be flushed into the IoTDB
+
+### max_retries [int]
+
+The number of retries to flush failed
+
+### retry_backoff_multiplier_ms [int]
+
+Using as a multiplier for generating the next delay for backoff
+
+### max_retry_backoff_ms [int]
+
+The amount of time to wait before attempting to retry a request to `IoTDB`
+
+### default_thrift_buffer_size [int]
+
+Thrift init buffer size in `IoTDB` client
+
+### max_thrift_frame_size [int]
+
+Thrift max frame size in `IoTDB` client
+
+### zone_id [string]
+
+java.time.ZoneId in `IoTDB` client
+
+### enable_rpc_compression [boolean]
+
+Enable rpc compression in `IoTDB` client
+
+### connection_timeout_in_ms [int]
+
+The maximum time (in ms) to wait when connect `IoTDB`
+
+### timeseries_options [list]
+
+Timeseries options
+
+### timeseries_options.path [string]
+
+Timeseries path
+
+### timeseries_options.data_type [string]
+
+Timeseries data type
+
+### common options [string]
+
+Sink plugin common parameters, please refer to [Sink Common Options](common-options.md) for details
+
+## Examples
+
+```hocon
+sink {
+  Clickhouse {

Review Comment:
   ```suggestion
     IoTDB {
   ```



##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/sink/IoTDBSinkWriter.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.iotdb.sink;
+
+import org.apache.seatunnel.api.sink.SinkWriter;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.connectors.seatunnel.iotdb.config.SinkConfig;
+import org.apache.seatunnel.connectors.seatunnel.iotdb.serialize.DefaultSeaTunnelRowSerializer;
+import org.apache.seatunnel.connectors.seatunnel.iotdb.serialize.IoTDBRecord;
+import org.apache.seatunnel.connectors.seatunnel.iotdb.serialize.SeaTunnelRowSerializer;
+import org.apache.seatunnel.connectors.seatunnel.iotdb.state.IoTDBCommitInfo;
+import org.apache.seatunnel.connectors.seatunnel.iotdb.state.IoTDBSinkState;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.IOException;
+import java.util.Optional;
+
+@Slf4j
+public class IoTDBSinkWriter implements SinkWriter<SeaTunnelRow, IoTDBCommitInfo, IoTDBSinkState> {

Review Comment:
   ```suggestion
   public class IoTDBSinkWriter extends AbstractSimpleSink<SeaTunnelRow, Void> {
   ```
   Same as above.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org