未验证 提交 d944de9c 编写于 作者: W wshao08 提交者: GitHub

Move Session API updates into Native_API.md (#1706)

上级 399917af
<!--
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.
-->
## Summary for 0.9-0.10 IoTDB Session Interface Updates
Great changes have taken place in IoTDB session of version 0.10 compared to version 0.9.
We added a large numbers of new interfaces, and some old interfaces had new names or parameters.
Besides, all exceptions thrown by session interfaces are changed from *IoTDBSessionExeception* to *IoTDBConnectionException* or *StatementExecutionExeception*.
The detailed modifications are listed as follows.
### Method name modifications
#### insert()
Insert a Record,which contains deviceId, timestamp of the record and multiple measurement values
```
void insert(String deviceId, long time, List<String> measurements, List<String> values)
```
The method name has been changed to insertRecord() in 0.10 version
```
void insertRecord(String deviceId, long time, List<String> measurements, List<String> values)
```
#### insertRowInBatch()
Insert multiple Records, which contains all the deviceIds, timestamps of the records and multiple measurement values
```
void insertRowInBatch(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
The method name has been changed to insertRecords() in 0.10 version
```
void insertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
#### insertBatch()
In 0.9, insertBatch is used for insertion in terms of "RowBatch" structure.
```
void insertBatch(RowBatch rowBatch)
```
As "Tablet" replaced "RowBatch" in 0.10, the name has been changed to insertTablet()
```
void insertTablet(Tablet tablet)
```
#### testInsertRow()
To test the responsiveness of insertRow()
```
void testInsertRow(String deviceId, long time, List<String> measurements, List<String> values)
```
The method name has been changed to testInsertRecord() in 0.10 version
```
void testInsertRecord(String deviceId, long time, List<String> measurements, List<String> values)
```
#### testInsertRowInBatch()
To test the responsiveness of insertRowInBatch()
```
void testInsertRowInBatch(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
The method name has been changed to testInsertRecords() in 0.10 version
```
void testInsertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
#### testInsertBatch
To test the responsiveness of insertBatch()
```
void testInsertBatch(RowBatch rowBatch)
```
The method name has been changed to testInsertTablet() in 0.10 version
```
void testInsertTablet(Tablet tablet)
```
### New Interfaces
```
void open(boolean enableRPCCompression)
```
Open a session, with a parameter to specify whether to enable RPC compression.
Please pay attention that this RPC compression status of client must comply with the status of IoTDB server
```
void insertRecord(String deviceId, long time, List<String> measurements,
List<TSDataType> types, List<Object> values)
```
Insert one record, in a way that user has to provide the type information of each measurement, which is different from the original insertRecord() interface.
The values should be provided in their primitive types. This interface is more proficient than the one without type parameters.
```
void insertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<TSDataType>> typesList, List<List<Object>> valuesList)
```
Insert multiple records with type parameters. This interface is more proficient than the one without type parameters.
```
void insertTablet(Tablet tablet, boolean sorted)
```
An additional insertTablet() interface that providing a "sorted" parameter indicating if the tablet is in order. A sorted tablet may accelerate the insertion process.
```
void insertTablets(Map<String, Tablet> tablets)
```
A new insertTablets() for inserting multiple tablets.
```
void insertTablets(Map<String, Tablet> tablets, boolean sorted)
```
insertTablets() with an additional "sorted" parameter.
```
void testInsertRecord(String deviceId, long time, List<String> measurements, List<TSDataType> types,
List<Object> values)
void testInsertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<TSDataType>> typesList, List<List<Object>> valuesList)
void testInsertTablet(Tablet tablet, boolean sorted)
void testInsertTablets(Map<String, Tablet> tablets)
void testInsertTablets(Map<String, Tablet> tablets, boolean sorted)
```
The above interfaces are newly added to test responsiveness of new insert interfaces.
```
void createTimeseries(String path, TSDataType dataType, TSEncoding encoding, CompressionType compressor,
Map<String, String> props, Map<String, String> tags, Map<String, String> attributes,
String measurementAlias)
```
Create a timeseries with path, datatype, encoding and compression. Additionally, users can provide props, tags, attributes and measurementAlias。
```
void createMultiTimeseries(List<String> paths, List<TSDataType> dataTypes, List<TSEncoding> encodings,
List<CompressionType> compressors, List<Map<String, String>> propsList,
List<Map<String, String>> tagsList, List<Map<String, String>> attributesList,
List<String> measurementAliasList)
```
Create multiple timeseries with a single method. Users can provide props, tags, attributes and measurementAlias as well for detailed timeseries information.
```
boolean checkTimeseriesExists(String path)
```
Added a method to check whether the specific timeseries exists.
......@@ -212,4 +212,181 @@ you have to call `SessionPool.closeResultSet(wrapper)` manually;
Examples: ```session/src/test/java/org/apache/iotdb/session/pool/SessionPoolTest.java```
Or `example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java`
\ No newline at end of file
Or `example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java`
## 0.9-0.10 Session Interface Updates
Great changes have taken place in IoTDB session of version 0.10 compared to version 0.9.
We added a large numbers of new interfaces, and some old interfaces had new names or parameters.
Besides, all exceptions thrown by session interfaces are changed from *IoTDBSessionExeception* to *IoTDBConnectionException* or *StatementExecutionExeception*.
The detailed modifications are listed as follows.
### Method name modifications
#### insert()
Insert a Record,which contains deviceId, timestamp of the record and multiple measurement values
```
void insert(String deviceId, long time, List<String> measurements, List<String> values)
```
The method name has been changed to insertRecord() in 0.10 version
```
void insertRecord(String deviceId, long time, List<String> measurements, List<String> values)
```
#### insertRowInBatch()
Insert multiple Records, which contains all the deviceIds, timestamps of the records and multiple measurement values
```
void insertRowInBatch(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
The method name has been changed to insertRecords() in 0.10 version
```
void insertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
#### insertBatch()
In 0.9, insertBatch is used for insertion in terms of "RowBatch" structure.
```
void insertBatch(RowBatch rowBatch)
```
As "Tablet" replaced "RowBatch" in 0.10, the name has been changed to insertTablet()
```
void insertTablet(Tablet tablet)
```
#### testInsertRow()
To test the responsiveness of insertRow()
```
void testInsertRow(String deviceId, long time, List<String> measurements, List<String> values)
```
The method name has been changed to testInsertRecord() in 0.10 version
```
void testInsertRecord(String deviceId, long time, List<String> measurements, List<String> values)
```
#### testInsertRowInBatch()
To test the responsiveness of insertRowInBatch()
```
void testInsertRowInBatch(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
The method name has been changed to testInsertRecords() in 0.10 version
```
void testInsertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
#### testInsertBatch
To test the responsiveness of insertBatch()
```
void testInsertBatch(RowBatch rowBatch)
```
The method name has been changed to testInsertTablet() in 0.10 version
```
void testInsertTablet(Tablet tablet)
```
### New Interfaces
```
void open(boolean enableRPCCompression)
```
Open a session, with a parameter to specify whether to enable RPC compression.
Please pay attention that this RPC compression status of client must comply with the status of IoTDB server
```
void insertRecord(String deviceId, long time, List<String> measurements,
List<TSDataType> types, List<Object> values)
```
Insert one record, in a way that user has to provide the type information of each measurement, which is different from the original insertRecord() interface.
The values should be provided in their primitive types. This interface is more proficient than the one without type parameters.
```
void insertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<TSDataType>> typesList, List<List<Object>> valuesList)
```
Insert multiple records with type parameters. This interface is more proficient than the one without type parameters.
```
void insertTablet(Tablet tablet, boolean sorted)
```
An additional insertTablet() interface that providing a "sorted" parameter indicating if the tablet is in order. A sorted tablet may accelerate the insertion process.
```
void insertTablets(Map<String, Tablet> tablets)
```
A new insertTablets() for inserting multiple tablets.
```
void insertTablets(Map<String, Tablet> tablets, boolean sorted)
```
insertTablets() with an additional "sorted" parameter.
```
void testInsertRecord(String deviceId, long time, List<String> measurements, List<TSDataType> types,
List<Object> values)
void testInsertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<TSDataType>> typesList, List<List<Object>> valuesList)
void testInsertTablet(Tablet tablet, boolean sorted)
void testInsertTablets(Map<String, Tablet> tablets)
void testInsertTablets(Map<String, Tablet> tablets, boolean sorted)
```
The above interfaces are newly added to test responsiveness of new insert interfaces.
```
void createTimeseries(String path, TSDataType dataType, TSEncoding encoding, CompressionType compressor,
Map<String, String> props, Map<String, String> tags, Map<String, String> attributes,
String measurementAlias)
```
Create a timeseries with path, datatype, encoding and compression. Additionally, users can provide props, tags, attributes and measurementAlias。
```
void createMultiTimeseries(List<String> paths, List<TSDataType> dataTypes, List<TSEncoding> encodings,
List<CompressionType> compressors, List<Map<String, String>> propsList,
List<Map<String, String>> tagsList, List<Map<String, String>> attributesList,
List<String> measurementAliasList)
```
Create multiple timeseries with a single method. Users can provide props, tags, attributes and measurementAlias as well for detailed timeseries information.
```
boolean checkTimeseriesExists(String path)
```
Added a method to check whether the specific timeseries exists.
<!--
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.
-->
## 0.9-0.10 版本IoTDB Session 接口更新总结
从0.9到0.10版本的IoTDB session接口有了较大改变。一部分接口名称和参数类型发生了变化,另外新增了大量可用接口。所有session接口抛出的异常类型 *IoTDBSessionExeception* 更改为 *IoTDBConnectionException**StatementExecutionExeception* 。下面详细介绍具体接口的变化。
### 接口名称更改
#### insert()
用于插入一行数据,需提供数据点的deviceId, time, 所有measurement和相应的value值。
```
void insert(String deviceId, long time, List<String> measurements, List<String> values)
```
该方法在0.10版本中方法名发生变化
```
void insertRecord(String deviceId, long time, List<String> measurements, List<String> values)
```
#### insertRowInBatch()
用于插入多行数据,需提供各行数据的deviceId, time, 所有measurement名称和相应的value值。
```
void insertRowInBatch(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
该方法在0.10版本中方法名发生变化
```
void insertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
#### insertBatch()
在0.9版本中用于以"RowBatch"结构为单位插入数据
```
void insertBatch(RowBatch rowBatch)
```
在0.10版本中"RowBatch"类型更改为"Tablet"类型,因此方法名也随之改变。
```
void insertTablet(Tablet tablet)
```
#### testInsertRow()
用于测试插入一行接口的响应
```
void testInsertRow(String deviceId, long time, List<String> measurements, List<String> values)
```
在0.10版本中方法名改为testInsertRecord。
```
void testInsertRecord(String deviceId, long time, List<String> measurements, List<String> values)
```
#### testInsertRowInBatch()
用于测试插入多行数据接口的响应
```
void testInsertRowInBatch(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
在0.10版本中方法名改为testInsertRecords
```
void testInsertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
#### testInsertBatch
用于测试以RowBatch结构为单位插入数据的响应
```
void testInsertBatch(RowBatch rowBatch)
```
在0.10版本中RowBatch类型更改为Tabet类型,因此方法名也随之改变为testInsertTablet
```
void testInsertTablet(Tablet tablet)
```
### 新增接口
```
void open(boolean enableRPCCompression)
```
开启一个session,并指定是否启用RPC压缩。注意客户端开启PRC压缩的状态需与服务端保持一致。
```
void insertRecord(String deviceId, long time, List<String> measurements,
List<TSDataType> types, List<Object> values)
```
插入一行数据,该方法和已有的insertRecord()方法不同在于需额外提供每个measurement的类型信息types,且参数values以原始类型的方式提供。写入速度相对于参数为String格式的insertRecord接口要快一些。
```
void insertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<TSDataType>> typesList, List<List<Object>> valuesList)
```
插入多行数据,该方法和已有的insertRecords()方法不同在于需额外提供每个measurement的类型信息typesList,且参数valuesList以原始类型的方式提供。写入速度相对于参数为String格式的insertRecords接口要快一些。
```
void insertTablet(Tablet tablet, boolean sorted)
```
提供额外的sorted参数,表示tablet是否内部已排好序,如sorted为真则会省去排序的过程从而提升处理速度。
```
void insertTablets(Map<String, Tablet> tablets)
```
新增insertTablets接口用于写入多个tablet结构,tablets参数为Map<device名, tablet数据>
```
void insertTablets(Map<String, Tablet> tablets, boolean sorted)
```
带额外sorted参数的insertTablets接口
```
void testInsertRecord(String deviceId, long time, List<String> measurements, List<TSDataType> types,
List<Object> values)
void testInsertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<TSDataType>> typesList, List<List<Object>> valuesList)
void testInsertTablet(Tablet tablet, boolean sorted)
void testInsertTablets(Map<String, Tablet> tablets)
void testInsertTablets(Map<String, Tablet> tablets, boolean sorted)
```
以上接口均为新增的测试rpc响应的方法,用于测试新增的写入接口
```
void createTimeseries(String path, TSDataType dataType, TSEncoding encoding, CompressionType compressor,
Map<String, String> props, Map<String, String> tags, Map<String, String> attributes,
String measurementAlias)
```
在原来createTimeseries接口的基础上,创建时间序列可以额外指定时间序列的props, tags, attributes和measurementAlias。如果不需要指定以上额外参数可以将参数设为null。
```
void createMultiTimeseries(List<String> paths, List<TSDataType> dataTypes, List<TSEncoding> encodings,
List<CompressionType> compressors, List<Map<String, String>> propsList,
List<Map<String, String>> tagsList, List<Map<String, String>> attributesList,
List<String> measurementAliasList)
```
一次性创建多个时间序列,同时也可以指定多个时间序列的props, tags, attributes和measurementAlias。
```
boolean checkTimeseriesExists(String path)
```
用于检测时间序列是否存在
......@@ -206,4 +206,176 @@
使用示例可以参见 ```session/src/test/java/org/apache/iotdb/session/pool/SessionPoolTest.java```
`example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java`
\ No newline at end of file
`example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java`
## 0.9-0.10 版本IoTDB Session 接口更新
从0.9到0.10版本的IoTDB session接口有了较大改变。一部分接口名称和参数类型发生了变化,另外新增了大量可用接口。所有session接口抛出的异常类型 *IoTDBSessionExeception* 更改为 *IoTDBConnectionException**StatementExecutionExeception* 。下面详细介绍具体接口的变化。
### 接口名称更改
#### insert()
用于插入一行数据,需提供数据点的deviceId, time, 所有measurement和相应的value值。
```
void insert(String deviceId, long time, List<String> measurements, List<String> values)
```
该方法在0.10版本中方法名发生变化
```
void insertRecord(String deviceId, long time, List<String> measurements, List<String> values)
```
#### insertRowInBatch()
用于插入多行数据,需提供各行数据的deviceId, time, 所有measurement名称和相应的value值。
```
void insertRowInBatch(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
该方法在0.10版本中方法名发生变化
```
void insertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
#### insertBatch()
在0.9版本中用于以"RowBatch"结构为单位插入数据
```
void insertBatch(RowBatch rowBatch)
```
在0.10版本中"RowBatch"类型更改为"Tablet"类型,因此方法名也随之改变。
```
void insertTablet(Tablet tablet)
```
#### testInsertRow()
用于测试插入一行接口的响应
```
void testInsertRow(String deviceId, long time, List<String> measurements, List<String> values)
```
在0.10版本中方法名改为testInsertRecord。
```
void testInsertRecord(String deviceId, long time, List<String> measurements, List<String> values)
```
#### testInsertRowInBatch()
用于测试插入多行数据接口的响应
```
void testInsertRowInBatch(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
在0.10版本中方法名改为testInsertRecords
```
void testInsertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<String>> valuesList)
```
#### testInsertBatch
用于测试以RowBatch结构为单位插入数据的响应
```
void testInsertBatch(RowBatch rowBatch)
```
在0.10版本中RowBatch类型更改为Tabet类型,因此方法名也随之改变为testInsertTablet
```
void testInsertTablet(Tablet tablet)
```
### 新增接口
```
void open(boolean enableRPCCompression)
```
开启一个session,并指定是否启用RPC压缩。注意客户端开启PRC压缩的状态需与服务端保持一致。
```
void insertRecord(String deviceId, long time, List<String> measurements,
List<TSDataType> types, List<Object> values)
```
插入一行数据,该方法和已有的insertRecord()方法不同在于需额外提供每个measurement的类型信息types,且参数values以原始类型的方式提供。写入速度相对于参数为String格式的insertRecord接口要快一些。
```
void insertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<TSDataType>> typesList, List<List<Object>> valuesList)
```
插入多行数据,该方法和已有的insertRecords()方法不同在于需额外提供每个measurement的类型信息typesList,且参数valuesList以原始类型的方式提供。写入速度相对于参数为String格式的insertRecords接口要快一些。
```
void insertTablet(Tablet tablet, boolean sorted)
```
提供额外的sorted参数,表示tablet是否内部已排好序,如sorted为真则会省去排序的过程从而提升处理速度。
```
void insertTablets(Map<String, Tablet> tablets)
```
新增insertTablets接口用于写入多个tablet结构,tablets参数为Map<device名, tablet数据>
```
void insertTablets(Map<String, Tablet> tablets, boolean sorted)
```
带额外sorted参数的insertTablets接口
```
void testInsertRecord(String deviceId, long time, List<String> measurements, List<TSDataType> types,
List<Object> values)
void testInsertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList,
List<List<TSDataType>> typesList, List<List<Object>> valuesList)
void testInsertTablet(Tablet tablet, boolean sorted)
void testInsertTablets(Map<String, Tablet> tablets)
void testInsertTablets(Map<String, Tablet> tablets, boolean sorted)
```
以上接口均为新增的测试rpc响应的方法,用于测试新增的写入接口
```
void createTimeseries(String path, TSDataType dataType, TSEncoding encoding, CompressionType compressor,
Map<String, String> props, Map<String, String> tags, Map<String, String> attributes,
String measurementAlias)
```
在原来createTimeseries接口的基础上,创建时间序列可以额外指定时间序列的props, tags, attributes和measurementAlias。如果不需要指定以上额外参数可以将参数设为null。
```
void createMultiTimeseries(List<String> paths, List<TSDataType> dataTypes, List<TSEncoding> encodings,
List<CompressionType> compressors, List<Map<String, String>> propsList,
List<Map<String, String>> tagsList, List<Map<String, String>> attributesList,
List<String> measurementAliasList)
```
一次性创建多个时间序列,同时也可以指定多个时间序列的props, tags, attributes和measurementAlias。
```
boolean checkTimeseriesExists(String path)
```
用于检测时间序列是否存在
\ No newline at end of file
......@@ -444,8 +444,7 @@ var config = {
['Client/Programming - Other Languages','Other Languages'],
['Client/Programming - TsFile API','TsFile API'],
['Client/Programming - MQTT','MQTT'],
['Client/Status Codes','Status Codes'],
['Client/Native API Update(0.9-0.10)','Native API Update(0.9-0.10)']
['Client/Status Codes','Status Codes']
]
},
{
......@@ -966,8 +965,7 @@ var config = {
['Client/Programming - Other Languages','其他语言'],
['Client/Programming - TsFile API','TsFile API'],
['Client/Programming - MQTT','MQTT'],
['Client/Status Codes','状态码'],
['Client/Native API Update(0.9-0.10)','0.9-0.10的原生接口更新']
['Client/Status Codes','状态码']
]
},
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册