-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supplement 2.0.0 version UserGuide and modify Download #365
base: develop
Are you sure you want to change the base?
Changes from 3 commits
0227844
13ae191
80b37f1
52e26dc
181d2c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!-- | ||
|
||
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. | ||
|
||
--> | ||
|
||
# Download | ||
Our GitHub page: https://github.com/apache/tsfile | ||
|
||
The latest version of TsFile is 2.0.0. | ||
|
||
Downloading it from the [Maven central repository](https://search.maven.org/search?q=g:org.apache.tsfile) | ||
|
||
Add the following dependency section to your pom.xml: | ||
|
||
``` | ||
<dependency> | ||
<groupId>org.apache.tsfile</groupId> | ||
<artifactId>tsfile</artifactId> | ||
<version>2.0.0</version> | ||
</dependency> | ||
``` | ||
|
||
The release note of 2.0.0 can be found in the Archives of the Apache Software Foundation: https://github.com/apache/tsfile/releases/tag/v2.0.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!-- | ||
|
||
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. | ||
|
||
--> | ||
# Data Model | ||
|
||
## Basic Concepts | ||
|
||
To manage industrial IoT timing data, the measurement point data model of TsFile includes the following information | ||
|
||
- DeviceId(String):Device Name | ||
- MeasurementSchema:Measurement points | ||
- measurementId(String):Measurement Point Name | ||
- tsDataType(TSDataType):Data Type | ||
|
||
For the above detailed introduction, please refer to:[Entering Time Series Data](https://tsfile.apache.org/UserGuide/latest/QuickStart/Navigating_Time_Series_Data.html) | ||
|
||
## Example | ||
|
||
![](https://alioss.timecho.com/docs/img/20240502164237-dkcm.png) | ||
|
||
In the above example, the metadata (Scheme) of TsFile contains 2 devices and 5 time series, and is established as a table structure as shown in the following figure: | ||
|
||
<table> | ||
<tr> | ||
<th rowspan="1">Device ID</th> | ||
<th rowspan="1">Measurement points</th> | ||
</tr> | ||
<tr> | ||
<th rowspan="2">Solar panel 1</th> | ||
<th>Voltage(FLOAT)</th> | ||
</tr> | ||
<tr> | ||
<th>Current(FLOAT)</th> | ||
</tr> | ||
<tr> | ||
<th rowspan="4">Fan1</th> | ||
</tr> | ||
<tr> | ||
<th>Voltage(FLOAT)</th> | ||
</tr> | ||
<tr> | ||
<th>Current(FLOAT)</th> | ||
</tr> | ||
<tr> | ||
<th>Wind Speed(FLOAT)</th> | ||
</tr> | ||
</table> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<!-- | ||
|
||
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. | ||
|
||
--> | ||
# Quick Start | ||
|
||
## Sample Data | ||
|
||
![](https://alioss.timecho.com/docs/img/2024050517481.png) | ||
|
||
## Installation Method | ||
|
||
Add the following content to the `dependencies` in `pom.xml` | ||
|
||
```shell | ||
<dependency> | ||
<groupId>org.apache.tsfile</groupId> | ||
<artifactId>tsfile</artifactId> | ||
<version>2.0.0</version> | ||
</dependency> | ||
``` | ||
|
||
## Writing Process | ||
|
||
### Construct TsFileWriter | ||
|
||
```shell | ||
File f = new File("test.tsfile"); | ||
TsFileWriter tsFileWriter = new TsFileWriter(f); | ||
``` | ||
|
||
### Registration Time Series | ||
|
||
```shell | ||
List<MeasurementSchema> schema1 = new ArrayList<>(); | ||
schema1.add(new MeasurementSchema("voltage", TSDataType.FLOAT)); | ||
schema1.add(new MeasurementSchema("current", TSDataType.FLOAT)); | ||
tsFileWriter.registerTimeseries(new Path("Solar_panel_1"), schema1); | ||
|
||
List<MeasurementSchema> schema2 = new ArrayList<>(); | ||
schema2.add(new MeasurementSchema("voltage", TSDataType.FLOAT)); | ||
schema2.add(new MeasurementSchema("current", TSDataType.FLOAT)); | ||
schema2.add(new MeasurementSchema("wind_speed", TSDataType.FLOAT)); | ||
tsFileWriter.registerTimeseries(new Path("Fan_1"), schema2); | ||
``` | ||
|
||
### Write Data | ||
|
||
```shell | ||
TSRecord tsRecord = new TSRecord(1, "Solar_panel_1"); | ||
tsRecord.addTuple(DataPoint.getDataPoint(TSDataType.FLOAT, "voltage", 1.1f)); | ||
tsRecord.addTuple(DataPoint.getDataPoint(TSDataType.FLOAT, "current", 2.2f)); | ||
tsFileWriter.write(tsRecord); | ||
``` | ||
|
||
### Close File | ||
|
||
```shell | ||
tsFileWriter.close(); | ||
``` | ||
|
||
### Sample Code | ||
|
||
<https://github.com/apache/tsfile/blob/develop/java/examples/src/main/java/org/apache/tsfile/TsFileWriteWithTSRecord.java> | ||
|
||
## Query Process | ||
|
||
### Construct TsFileReader | ||
|
||
```shell | ||
TsFileSequenceReader reader = new TsFileSequenceReader(path); | ||
TsFileReader tsFileReader = new TsFileReader(reader); | ||
``` | ||
|
||
### Construct Query Request | ||
|
||
```shell | ||
ArrayList<Path> paths = new ArrayList<>(); | ||
paths.add(new Path("Solar_panel_1", "voltage",true)); | ||
paths.add(new Path("Solar_panel_1", "current",true)); | ||
|
||
IExpression timeFilter = | ||
BinaryExpression.and( | ||
new GlobalTimeExpression(TimeFilterApi.gtEq(4L)), | ||
new GlobalTimeExpression(TimeFilterApi.ltEq(10L))); | ||
|
||
QueryExpression queryExpression = QueryExpression.create(paths, timeFilter); | ||
``` | ||
|
||
### Query Data | ||
|
||
```shell | ||
QueryDataSet queryDataSet = tsFileReader.query(queryExpression); | ||
while (queryDataSet.hasNext()) { | ||
queryDataSet.next(); | ||
} | ||
``` | ||
|
||
### Close File | ||
|
||
```shell | ||
tsFileReader.close(); | ||
``` | ||
|
||
### Sample Code | ||
|
||
<https://github.com/apache/tsfile/blob/develop/java/examples/src/main/java/org/apache/tsfile/TsFileRead.java> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Separate the zh and en docs into two directories. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok,done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!-- | ||
|
||
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. | ||
|
||
--> | ||
# 数据模型 | ||
|
||
## 基础概念 | ||
|
||
为管理工业物联网时序数据,TsFile 的测点数据模型包含如下信息 | ||
|
||
- TAG:标识列 | ||
- name(String):列名 | ||
- dataType(TSDataType):数据类型 | ||
- FIELD:物理量列 | ||
- name(String):列名 | ||
- dataType(TSDataType):数据类型 | ||
|
||
<table> | ||
<tr> | ||
<th rowspan="1">概念</th> | ||
<th rowspan="1">定义</th> | ||
</tr> | ||
<tr> | ||
<th rowspan="1">表</th> | ||
<th>一类具有相同模式的设备的集合。建模时定义的存储表由标识列、时间列和物理量列三部分组成。</th> | ||
</tr> | ||
<tr> | ||
<th rowspan="1">设备标识列</th> | ||
<th>设备唯一标识,一个表内可包含0至多个标识列,标识列的值按建表时的列顺序组合形成的复合值称为标识,复合值相同的标识为同一标识。标识列的数据类型目前只能为String,可以不指定,默认为String标识列的值可以全为空写入时必须指定所有标识列(未指定的标识列默认使用 null 填充)</th> | ||
</tr> | ||
<tr> | ||
<th rowspan="1">时间列</th> | ||
<th>一个表必须有一列时间列,相同标识取值的数据默认按时间排序。时间列的值不能为空,必须顺序的。</th> | ||
</tr> | ||
<tr> | ||
<th rowspan="1">物理量列</th> | ||
<th>测点列定义了时序数据的测点名称、数据类型。</th> | ||
</tr> | ||
<tr> | ||
<th rowspan="1">行</th> | ||
<th>表中的一行数据</th> | ||
</tr> | ||
</table> | ||
|
||
|
||
## 示例 | ||
|
||
表是一类具有相同模式的设备的集合。如下图所示,是一个工厂设备的建模管理,每个设备的物理量采集都具备一定共性(如都采集温度和湿度物理量、同一设备的物理量同频采集等),因此可以以设备为单位进行管理。 | ||
|
||
此时通过【地区】-【工厂】-【设备】(下图橙色列,又称设备标识信息)可以唯一确定一个实体设备,设备最终采集的指标为【温度】、【湿度】、【状态】、【到达时间】(下图蓝色列)。 | ||
|
||
![](https://alioss.timecho.com/docs/img/data_model_example_image-zh.png) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,42 +24,45 @@ | |
|
||
To manage industrial IoT timing data, the measurement point data model of TsFile includes the following information | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To manage industrial IoT time series data, the data model of TsFile includes the following concepts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok,done |
||
|
||
- DeviceId(String):Device Name | ||
- MeasurementSchema:Measurement points | ||
- measurementId(String):Measurement Point Name | ||
- tsDataType(TSDataType):Data Type | ||
|
||
For the above detailed introduction, please refer to:[Entering Time Series Data](https://tsfile.apache.org/UserGuide/latest/QuickStart/Navigating_Time_Series_Data.html) | ||
|
||
## Example | ||
|
||
![](https://alioss.timecho.com/docs/img/20240502164237-dkcm.png) | ||
|
||
In the above example, the metadata (Scheme) of TsFile contains 2 devices and 5 time series, and is established as a table structure as shown in the following figure: | ||
- TAG:Tag Column | ||
- name(String):Column Name | ||
- dataType(TSDataType):Data Type | ||
- FIELD:Field Column | ||
- name(String):Column Name | ||
- dataType(TSDataType):Data Type | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok,done |
||
|
||
<table> | ||
<tr> | ||
<th rowspan="1">Device ID</th> | ||
<th rowspan="1">Measurement points</th> | ||
<th rowspan="1">concept</th> | ||
<th rowspan="1">definition</th> | ||
</tr> | ||
<tr> | ||
<th rowspan="2">Solar panel 1</th> | ||
<th>Voltage(FLOAT)</th> | ||
<th rowspan="1">table</th> | ||
<th>A collection of devices with the same pattern.The storage table defined during modeling consists of three parts: identification column, time column, and physical quantity column.</th> | ||
</tr> | ||
<tr> | ||
<th>Current(FLOAT)</th> | ||
<th rowspan="1">TAG</th> | ||
<th>The unique identifier of a device, which can contain 0 to multiple tag columns in a table. The composite value formed by combining the values of the tag columns in the column order when the table was created is called the identifier, and tags with the same composite value are called the same identifier.The data type of the tag column can currently only be String, which can be left unspecified and defaults to StringThe values of the identification column can all be emptyWhen writing, all tag columns must be specified (unspecified identity columns are filled with null by default)</th> | ||
</tr> | ||
<tr> | ||
<th rowspan="4">Fan1</th> | ||
<th rowspan="1">Time</th> | ||
<th>A table must have a time column, and data with the same identifier value is sorted by time by default.The values in the time column cannot be empty and must be in sequence.</th> | ||
</tr> | ||
<tr> | ||
<th>Voltage(FLOAT)</th> | ||
</tr> | ||
<tr> | ||
<th>Current(FLOAT)</th> | ||
<th rowspan="1">FIELD</th> | ||
<th>The field column defines the measurement point names and data types for time-series data.</th> | ||
</tr> | ||
<tr> | ||
<th>Wind Speed(FLOAT)</th> | ||
<th rowspan="1">row</th> | ||
<th>A row of data in the table</th> | ||
</tr> | ||
</table> | ||
|
||
|
||
## Example | ||
|
||
A table is a collection of devices with the same pattern. As shown in the figure below, it is a modeling management of factory equipment, and the physical quantity collection of each device has certain commonalities (such as collecting temperature and humidity physical quantities, collecting physical quantities of the same device on the same frequency, etc.), so it can be managed on a device by device basis. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A table is -> A schema describes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok,done |
||
|
||
At this point, a physical device can be uniquely identified through [Region] - [Factory] - [Equipment] (orange column in the figure below, also known as device identification information). The final indicators collected by the device are [Temperature], [Humidity], [Status], and [Arrival Time] (blue column in the figure below). | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. identified through -> identified through 3 Tags There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok,done |
||
![](https://alioss.timecho.com/docs/img/data_model_example_image.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one readme is enough for “download.”
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,done