This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 5d91586 add SDT docs (#2307)
5d91586 is described below
commit 5d9158601db7e0c7c0d68fd9f41c0b4438b0416c
Author: Haimei Guo <[email protected]>
AuthorDate: Tue Dec 22 19:46:27 2020 +0800
add SDT docs (#2307)
---
docs/UserGuide/Concept/SDT.md | 63 ++++++++++++++++++++++++++++++++++++++++
docs/zh/UserGuide/Concept/SDT.md | 61 ++++++++++++++++++++++++++++++++++++++
2 files changed, 124 insertions(+)
diff --git a/docs/UserGuide/Concept/SDT.md b/docs/UserGuide/Concept/SDT.md
index e6ea2a9..1079a1d 100644
--- a/docs/UserGuide/Concept/SDT.md
+++ b/docs/UserGuide/Concept/SDT.md
@@ -24,6 +24,8 @@
The Swinging Door Trending (SDT) algorithm is a lossy compression algorithm.
SDT has low computational complexity and uses a linear trend to represent a
quantity of data.
+In IoTDB SDT compresses and discards data when flushing into the disk.
+
IoTDB allows you to specify the properties of SDT when creating a time series,
and supports three properties:
* CompDev (Compression Deviation)
@@ -43,3 +45,64 @@ It measures the time difference between stored points. If
the current point time
stored point's time distance is greater than or equal to compMax, current
point will be stored regardless of compression deviation.
The specified syntax for SDT is detailed in [Create Timeseries
Statement](../Operation%20Manual/SQL%20Reference.md).
+
+Supported datatypes:
+
+* INT32 (Integer)
+* INT64 (Long Integer)
+* FLOAT (Single Precision Floating Point)
+* DOUBLE (Double Precision Floating Point)
+
+The following is an example of using SDT compression.
+
+```
+IoTDB> CREATE TIMESERIES root.sg1.d0.s0 WITH
DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2
+```
+
+Prior to flushing and SDT compression, the results are shown below:
+
+```
+IoTDB> SELECT s0 FROM root.sg1.d0
++-----------------------------+--------------+
+| Time|root.sg1.d0.s0|
++-----------------------------+--------------+
+|2017-11-01T00:06:00.001+08:00| 1|
+|2017-11-01T00:06:00.002+08:00| 1|
+|2017-11-01T00:06:00.003+08:00| 1|
+|2017-11-01T00:06:00.004+08:00| 1|
+|2017-11-01T00:06:00.005+08:00| 1|
+|2017-11-01T00:06:00.006+08:00| 1|
+|2017-11-01T00:06:00.007+08:00| 1|
+|2017-11-01T00:06:00.015+08:00| 10|
+|2017-11-01T00:06:00.016+08:00| 20|
+|2017-11-01T00:06:00.017+08:00| 1|
+|2017-11-01T00:06:00.018+08:00| 30|
++-----------------------------+--------------+
+Total line number = 11
+It costs 0.008s
+```
+
+After flushing and SDT compression, the results are shown below:
+
+```
+IoTDB> FLUSH
+IoTDB> SELECT s0 FROM root.sg1.d0
++-----------------------------+--------------+
+| Time|root.sg1.d0.s0|
++-----------------------------+--------------+
+|2017-11-01T00:06:00.001+08:00| 1|
+|2017-11-01T00:06:00.007+08:00| 1|
+|2017-11-01T00:06:00.015+08:00| 10|
+|2017-11-01T00:06:00.016+08:00| 20|
+|2017-11-01T00:06:00.017+08:00| 1|
++-----------------------------+--------------+
+Total line number = 5
+It costs 0.044s
+```
+
+SDT takes effect when flushing to the disk. The SDT algorithm always stores
the first point and does not store the last point.
+
+The data in [2017-11-01T00:06:00.001, 2017-11-01T00:06:00.007] is within the
compression deviation thus discarded.
+The data point at time 2017-11-01T00:06:00.007 is stored because the next data
point at time 2017-11-01T00:06:00.015
+exceeds compression deviation. When a data point exceeds the compression
deviation, SDT stores the last read
+point and updates the upper and lower boundaries. The last point at time
2017-11-01T00:06:00.018 is not stored.
diff --git a/docs/zh/UserGuide/Concept/SDT.md b/docs/zh/UserGuide/Concept/SDT.md
index 1911c78..ce4c9a7 100644
--- a/docs/zh/UserGuide/Concept/SDT.md
+++ b/docs/zh/UserGuide/Concept/SDT.md
@@ -23,6 +23,8 @@
旋转门压缩(SDT)算法是一种有损压缩算法。SDT的计算复杂度较低,并使用线性趋势来表示大量数据。
+在IoTDB中,SDT在刷新到磁盘时会压缩并丢弃数据。
+
IoTDB允许您在创建时间序列时指定SDT的属性,并支持以下三个属性:
* CompDev (压缩偏差)
@@ -37,4 +39,63 @@ CompMin主要用于减少噪点。 CompMin测量两个存储的数据点之间
CompMax用于定期检查上一个存储的点到当前点之间的时间距离。它测量存储点之间的时间差。如果当前点时间到上一个存储点的时间距离
大于或等于compMax,无论压缩偏差值,都会存储当前数据点。
+支持的数据类型:
+
+* INT32(整型)
+* INT64(长整型)
+* FLOAT(单精度浮点数)
+* DOUBLE(双精度浮点数)
+
SDT的指定语法详见本文[5.4节](../Operation%20Manual/SQL%20Reference.md)。
+
+以下是使用SDT压缩的示例。
+
+```
+IoTDB> CREATE TIMESERIES root.sg1.d0.s0 WITH
DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2
+```
+
+刷入磁盘和SDT压缩之前,结果如下所示:
+
+```
+IoTDB> SELECT s0 FROM root.sg1.d0
++-----------------------------+--------------+
+| Time|root.sg1.d0.s0|
++-----------------------------+--------------+
+|2017-11-01T00:06:00.001+08:00| 1|
+|2017-11-01T00:06:00.002+08:00| 1|
+|2017-11-01T00:06:00.003+08:00| 1|
+|2017-11-01T00:06:00.004+08:00| 1|
+|2017-11-01T00:06:00.005+08:00| 1|
+|2017-11-01T00:06:00.006+08:00| 1|
+|2017-11-01T00:06:00.007+08:00| 1|
+|2017-11-01T00:06:00.015+08:00| 10|
+|2017-11-01T00:06:00.016+08:00| 20|
+|2017-11-01T00:06:00.017+08:00| 1|
+|2017-11-01T00:06:00.018+08:00| 30|
++-----------------------------+--------------+
+Total line number = 11
+It costs 0.008s
+```
+
+刷入磁盘和SDT压缩之后,结果如下所示:
+```
+IoTDB> FLUSH
+IoTDB> SELECT s0 FROM root.sg1.d0
++-----------------------------+--------------+
+| Time|root.sg1.d0.s0|
++-----------------------------+--------------+
+|2017-11-01T00:06:00.001+08:00| 1|
+|2017-11-01T00:06:00.007+08:00| 1|
+|2017-11-01T00:06:00.015+08:00| 10|
+|2017-11-01T00:06:00.016+08:00| 20|
+|2017-11-01T00:06:00.017+08:00| 1|
++-----------------------------+--------------+
+Total line number = 5
+It costs 0.044s
+```
+
+SDT在刷新到磁盘时进行压缩。 SDT算法始终存储第一个点,并且不存储最后一个点。
+
+时间范围在 [2017-11-01T00:06:00.001, 2017-11-01T00:06:00.007] 的数据在压缩偏差内,因此被压缩和丢弃。
+之所以存储时间为 2017-11-01T00:06:00.007 的数据点,是因为下一个数据点 2017-11-01T00:06:00.015
的值超过压缩偏差。
+当一个数据点超过压缩偏差时,SDT将存储上一个读取的数据点,并重新计算上下压缩边界。作为最后一个数据点,不存储时间
2017-11-01T00:06:00.018。