Skip to content

Commit

Permalink
Merge ef92e8f into 20b42cd
Browse files Browse the repository at this point in the history
  • Loading branch information
Jialin Qiao committed Dec 30, 2019
2 parents 20b42cd + ef92e8f commit e8c57ce
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 34 deletions.
Expand Up @@ -21,24 +21,19 @@

# 第4章: 客户端

# 编程 - Session
# 编程 - 原生接口

## 依赖

* JDK >= 1.8
* Maven >= 3.1

## 仅在client模块中打包

在根目录下运行:
> mvn clean package -pl client -am -Dmaven.test.skip=true
## 安装到本地 maven 库

在根目录下运行:
> mvn clean install -pl session -am -Dmaven.test.skip=true
## 在 maven 中使用 session 接口
## 在 maven 中使用原生接口

```
<dependencies>
Expand All @@ -50,10 +45,10 @@
</dependencies>
```

## Session 接口使用示例
## 原生接口使用示例
下面将给出Session对应的接口的简要介绍和对应参数:

### 启动Session的相关命令:
### 建立连接

* 初始化Session
​ Session(String host, int port)
Expand All @@ -66,7 +61,7 @@
* 关闭Session
​ Session.close()

### Session的相关数据操作命令
### 数据操作接口

* 设置存储组

Expand Down Expand Up @@ -101,6 +96,6 @@

### 示例代码

浏览上述接口的详细信息,请参阅代码session/src/main/java/org/apache/iotdb/session/Session.java
浏览上述接口的详细信息,请参阅代码 ```session/src/main/java/org/apache/iotdb/session/Session.java```

使用上述接口的示例代码在example/session/src/main/java/org/apache/iotdb/SessionExample.java,在此文件中包含了开启session和执行批量插入等操作
使用上述接口的示例代码在 ```example/session/src/main/java/org/apache/iotdb/SessionExample.java```
Expand Up @@ -20,25 +20,20 @@
-->

# Chapter 4: Client
# Programming - Session
# Programming - Native API
## Usage

### Dependencies

* JDK >= 1.8
* Maven >= 3.1

### How to package only client module

In root directory:
> mvn clean package -pl client -am -Dmaven.test.skip=true
### How to install in local maven repository

In root directory:
> mvn clean install -pl client -am -Dmaven.test.skip=true
> mvn clean install -pl session -am -DskipTests
### Using IoTDB Session with Maven
### Using IoTDB Native API with Maven

```
<dependencies>
Expand All @@ -51,11 +46,11 @@ In root directory:
```


### Examples with Session interfaces
### Examples with Native API

Here we show the commonly used interfaces and their parameters in the Session:
Here we show the commonly used interfaces and their parameters in the Native API:

#### Run the Session
#### Run the Native API

* Initialize a Session

Expand All @@ -73,7 +68,7 @@ Here we show the commonly used interfaces and their parameters in the Session:

​ Session.close()

#### Operate the Session
#### Operations

* Set storage group

Expand Down
Expand Up @@ -29,13 +29,6 @@
* JDK >= 1.8
* Maven >= 3.1

## How to package only jdbc project

In root directory:
```
mvn clean package -pl jdbc -am -Dmaven.test.skip=true
```

## How to install in local maven repository

In root directory:
Expand All @@ -50,7 +43,7 @@ mvn clean install -pl jdbc -am -Dmaven.test.skip=true
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-jdbc</artifactId>
<version>0.8.0</version>
<version>0.10.0</version>
</dependency>
</dependencies>
```
Expand Down
Expand Up @@ -24,8 +24,7 @@

TsFile is a file format of Time Series we used in IoTDB. In this section, we would like to introduce the usage of this file format.

## TsFile libaray Installation

## TsFile library Installation

There are two ways to use TsFile in your own project.

Expand Down
15 changes: 15 additions & 0 deletions example/session/src/main/java/org/apache/iotdb/SessionExample.java
Expand Up @@ -105,7 +105,22 @@ private static void insertInBatch() throws IoTDBSessionException {
session.insertInBatch(deviceIds, timestamps, measurementsList, valuesList);
}

/**
* insert a batch data of one device, each batch contains multiple timestamps with values of sensors
*
* a RowBatch example:
*
* device1
* time s1, s2, s3
* 1, 1, 1, 1
* 2, 2, 2, 2
* 3, 3, 3, 3
*
* Users need to control the count of RowBatch and write a batch when it reaches the maxBatchSize
*
*/
private static void insertRowBatch() throws IoTDBSessionException {
// The schema of sensors of one device
Schema schema = new Schema();
schema.registerMeasurement(new MeasurementSchema("s1", TSDataType.INT64, TSEncoding.RLE));
schema.registerMeasurement(new MeasurementSchema("s2", TSDataType.INT64, TSEncoding.RLE));
Expand Down

0 comments on commit e8c57ce

Please sign in to comment.