Project: SeaTunnel (App Definition and Development / Streaming & Messaging)
File: IoTDB.md

IoTDB source connector Spark<br/> Flink<br/> SeaTunnel Zeta<br/> Read external data source data through IoTDB. :::tip There is a conflict of thrift version between IoTDB and Spark.Therefore, you need to execute `rm -f $SPARKHOME/jars/libthrift*` and `cp $IOTDBHOME/lib/libthrift* $SPARK_HOME/jars/` to resolve it. ::: You need to ensure that the has been placed in directory `${SEATUNNEL_HOME}/plugins/`. You need to ensure that the has been placed in directory `${SEATUNNEL_HOME}/lib/`. supports query SQL and can achieve projection effect. | Datasource | Supported Versions | Url | ||--|-| | IoTDB | `>=

| localhost:6667 | | IotDB Data Type | SeaTunnel Data Type | |--|| | BOOLEAN | BOOLEAN | | INT32 | TINYINT | | INT32 | SMALLINT | | INT32 | INT | | INT64 | BIGINT | | FLOAT | FLOAT | | DOUBLE | DOUBLE | | TEXT | STRING | | Name | Type | Required | Default Value | Description | |-||-||| | node_urls | string | yes | - | `IoTDB` cluster address, the format is `"host1:port"` or `"host1:port,host2:port"` | | username | string | yes | - | `IoTDB` user username | | password | string | yes | - | `IoTDB` user password | | sql | string | yes | - | execute sql statement | | schema | config | yes | - | the data schema | | fetchsize | int | no | - | the fetchsize of the IoTDB when you select | | lowerbound | long | no | - | the lowerbound of the IoTDB when you select | | upperbound | long | no | - | the upperbound of the IoTDB when you select | | numpartitions | int | no | - | the numpartitions of the IoTDB when you select | | thriftdefaultbuffersize | int | no | - | the thriftdefaultbuffersize of the IoTDB when you select | | thriftmaxframe_size | int | no | - | the thrift max frame size | | enablecacheleader | boolean | no | - | enablecacheleader of the IoTDB when you select | | version | string | no | - | SQL semantic version used by the client, The possible values are: V012, V013 | | common-options | | no | - | | we can split the partitions of the IoTDB and we used time column split split num upper bound of the time column lower bound of the time column ``` split the time range into numPartitions parts if numPartitions is 1, use the whole time range if numPartitions < (upperbound - lowerbound), use (upperbound - lowerbound) partitions eg: lowerbound = 1, upperbound = 10, numPartitions = 2 sql = "select * from test where age > 0 and age < 10" split result split 1: select * from test where (time >= 1 and time < 6) and ( age > 0 and age < 10 ) split 2: select * from test where (time >= 6 and time < 11) and ( age > 0 and age < 10 ) ``` Source plugin common parameters, please refer to for details ```hocon env { parallelism = 2 job.mode = "BATCH" } source { IoTDB { node_urls = "localhost:6667" username = "root" password = "root" sql = "SELECT temperature, moisture, cint, cbigint, cfloat, cdouble, cstring, cboolean FROM root.test_group.* WHERE time < 4102329600000 align by device" schema { fields { ts = timestamp device_name = string temperature = float moisture = bigint c_int = int c_bigint = bigint c_float = float c_double = double c_string = string c_boolean = boolean } } } } sink { Console { } } ``` Upstream `IoTDB` data format is the following: ```shell IoTDB> SELECT temperature, moisture, cint, cbigint, cfloat, cdouble, cstring, cboolean FROM root.test_group.* WHERE time < 4102329600000 align by device; +++--+--+--+--+-+++-+ | Time| Device| temperature| moisture| cint| cbigint| cfloat| cdouble| cstring| cboolean| +++--+--+--+--+-+++-+ |2022-09-25T00:00:00.001Z|root.testgroup.devicea| 36.1| 100| 1| 21474836470| 1.0f| 1.0d| abc| true| |2022-09-25T00:00:00.001Z|root.testgroup.deviceb| 36.2| 101| 2| 21474836470| 2.0f| 2.0d| abc| true| |2022-09-25T00:00:00.001Z|root.testgroup.devicec| 36.3| 102| 3| 21474836470| 3.0f| 3.0d| abc| true| +++--+--+--+--+-+++-+ ``` Loaded to SeaTunnelRow data format is the following: | ts | devicename