This is an automated email from the ASF dual-hosted git repository.
hxd 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 1000dd6 clarify sdt doc (docs/UserGuide/Concept/SDT.md) (#2469)
1000dd6 is described below
commit 1000dd6f7e627686a9574be8d74b31d51bfd2400
Author: Haimei Guo <[email protected]>
AuthorDate: Thu Jan 21 17:51:33 2021 +0800
clarify sdt doc (docs/UserGuide/Concept/SDT.md) (#2469)
Co-authored-by: Haonan <[email protected]>
---
docs/UserGuide/Concept/SDT.md | 21 ++++---
docs/UserGuide/Operation Manual/SQL Reference.md | 10 +--
docs/zh/UserGuide/Concept/SDT.md | 17 +++--
.../zh/UserGuide/Operation Manual/SQL Reference.md | 10 +--
.../main/java/org/apache/iotdb/SessionExample.java | 12 ++--
.../iotdb/db/integration/IoTDBSimpleQueryIT.java | 6 +-
.../iotdb/tsfile/encoding/encoder/SDTEncoder.java | 72 +++++++++++-----------
.../iotdb/tsfile/write/chunk/ChunkWriterImpl.java | 10 +--
8 files changed, 83 insertions(+), 75 deletions(-)
diff --git a/docs/UserGuide/Concept/SDT.md b/docs/UserGuide/Concept/SDT.md
index 1079a1d..217b995 100644
--- a/docs/UserGuide/Concept/SDT.md
+++ b/docs/UserGuide/Concept/SDT.md
@@ -30,19 +30,22 @@ IoTDB allows you to specify the properties of SDT when
creating a time series, a
* CompDev (Compression Deviation)
-CompDev is the most important parameter in SDT that represents the maximum
difference between the current sample and the current linear trend.
+CompDev is the most important parameter in SDT that represents the maximum
difference between the
+current sample and the current linear trend. CompDev needs to be greater than
0 to perform compression.
-* CompMin (Compression Minimum)
+* CompMinTime (Compression Minimum Time Interval)
-CompMin is used for noisy reduction. CompMin measures the time distance
between two stored data points,
-if the current point's time to the last stored point's time distance is
smaller than or equal to compMin,
-current point will NOT be stored regardless of compression deviation.
+CompMinTime is a parameter measures the time distance between two stored data
points, which is used for noisy reduction.
+If the time interval between the current point and the last stored point is
less than or equal to its value,
+current point will NOT be stored regardless of compression deviation.
+The default value is 0 with time unit ms.
-* CompMax (Compression Maximum)
+* CompMaxTime (Compression Maximum Time Interval)
-CompMax is used to periodically check the time distance between the last
stored point to the current point.
-It measures the time difference between stored points. If the current point
time to the last
-stored point's time distance is greater than or equal to compMax, current
point will be stored regardless of compression deviation.
+CompMaxTime is a parameter measure the time distance between two stored data
points.
+If the time interval between the current point and the last stored point is
greater than or equal to its value,
+current point will be stored regardless of compression deviation.
+The default value is 9,223,372,036,854,775,807 with time unit ms.
The specified syntax for SDT is detailed in [Create Timeseries
Statement](../Operation%20Manual/SQL%20Reference.md).
diff --git a/docs/UserGuide/Operation Manual/SQL Reference.md
b/docs/UserGuide/Operation Manual/SQL Reference.md
index 4c28750..c412b6a 100644
--- a/docs/UserGuide/Operation Manual/SQL Reference.md
+++ b/docs/UserGuide/Operation Manual/SQL Reference.md
@@ -89,19 +89,19 @@ tagClause
DataTypeValue: BOOLEAN | DOUBLE | FLOAT | INT32 | INT64 | TEXT
EncodingValue: GORILLA | PLAIN | RLE | TS_2DIFF | REGULAR
CompressorValue: UNCOMPRESSED | SNAPPY
-propertyValue: SDT | COMPDEV | COMPMIN | COMPMAX
+propertyValue: SDT | COMPDEV | COMPMINTIME | COMPMAXTIME
Eg: CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN,
ENCODING=PLAIN
Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE
Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, COMPRESSOR=SNAPPY, MAX_POINT_NUMBER=3
Eg: create timeseries root.turbine.d0.s0(temperature) with datatype=FLOAT,
encoding=RLE, compression=SNAPPY tags(unit=f, description='turbine this is a
test1') attributes(H_Alarm=100, M_Alarm=50)
Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, LOSS=SDT, COMPDEV=0.01
-Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMIN=3
-Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMIN=2, COMPMAX=15
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMINTIME=3
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15
Note: Datatype and encoding type must be corresponding. Please check Chapter 3
Encoding Section for details.
Note: When propertyValue is SDT, it is required to set compression deviation
COMPDEV, which is the maximum absolute difference between values.
Note: For SDT, values withtin COMPDEV will be discarded.
-Note: For SDT, it is optional to set compression minimum COMPMIN, which is the
minimum time difference between stored values for purpose of noise reduction.
-Note: For SDT, it is optional to set compression maximum COMPMAX, which is the
maximum time difference between stored values regardless of COMPDEV.
+Note: For SDT, it is optional to set compression minimum COMPMINTIME, which is
the minimum time difference between stored values for purpose of noise
reduction.
+Note: For SDT, it is optional to set compression maximum COMPMAXTIME, which is
the maximum time difference between stored values regardless of COMPDEV.
```
* Delete Timeseries Statement
diff --git a/docs/zh/UserGuide/Concept/SDT.md b/docs/zh/UserGuide/Concept/SDT.md
index ce4c9a7..529c312 100644
--- a/docs/zh/UserGuide/Concept/SDT.md
+++ b/docs/zh/UserGuide/Concept/SDT.md
@@ -27,17 +27,22 @@
IoTDB允许您在创建时间序列时指定SDT的属性,并支持以下三个属性:
-* CompDev (压缩偏差)
+* CompDev (Compression Deviation,压缩偏差)
-CompDev是SDT中最重要的参数,代表当前样本和当前线性之间的最大差趋势。
+CompDev是SDT中最重要的参数,它表示当前样本与当前线性趋势之间的最大差值。CompDev设置的值需要大于0。
-* CompMin (最小压缩间隔)
+* CompMinTime (Compression Minimum Time Interval,最小压缩时间间隔)
-CompMin主要用于减少噪点。 CompMin测量两个存储的数据点之间的时间距离,如果当前点的时间到上一个存储的点的时间距离小于或等于compMin,
无论压缩偏差值,都不会存储当前数据点。
+CompMinTime是测量两个存储的数据点之间的时间距离的参数,用于减少噪声。
+如果当前点和最后存储的点之间的时间间隔小于或等于其值,则无论压缩偏差如何,都不会存储当前点。
+默认值为0,单位为毫秒。
-* CompMax (最大压缩间隔)
+* CompMaxTime (Compression Maximum Time Interval,最大压缩时间间隔)
-CompMax用于定期检查上一个存储的点到当前点之间的时间距离。它测量存储点之间的时间差。如果当前点时间到上一个存储点的时间距离
大于或等于compMax,无论压缩偏差值,都会存储当前数据点。
+CompMaxTime是测量两个存储的数据点之间的时间距离的参数。
+如果当前点和最后一个存储点之间的时间间隔大于或等于其值,
+无论压缩偏差如何,都将存储当前点。
+默认值为9,223,372,036,854,775,807,单位为毫秒。
支持的数据类型:
diff --git a/docs/zh/UserGuide/Operation Manual/SQL Reference.md
b/docs/zh/UserGuide/Operation Manual/SQL Reference.md
index 1af6f60..13464ba 100644
--- a/docs/zh/UserGuide/Operation Manual/SQL Reference.md
+++ b/docs/zh/UserGuide/Operation Manual/SQL Reference.md
@@ -79,19 +79,19 @@ tagClause
DataTypeValue: BOOLEAN | DOUBLE | FLOAT | INT32 | INT64 | TEXT
EncodingValue: GORILLA | PLAIN | RLE | TS_2DIFF | REGULAR
CompressorValue: UNCOMPRESSED | SNAPPY
-propertyValue: SDT | COMPDEV | COMPMIN | COMPMAX
+propertyValue: SDT | COMPDEV | COMPMINTIME | COMPMAXTIME
Eg: CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN,
ENCODING=PLAIN
Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE
Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, COMPRESSOR=SNAPPY, MAX_POINT_NUMBER=3
Eg: create timeseries root.turbine.d0.s0(temperature) with datatype=FLOAT,
encoding=RLE, compression=SNAPPY tags(unit=f, description='turbine this is a
test1') attributes(H_Alarm=100, M_Alarm=50)
Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, LOSS=SDT, COMPDEV=0.01
-Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMIN=3
-Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMIN=2, COMPMAX=15
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMINTIME=3
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT,
ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15
Note: Datatype and encoding type must be corresponding. Please check Chapter 3
Encoding Section for details.
Note: When propertyValue is SDT, it is required to set compression deviation
COMPDEV, which is the maximum absolute difference between values.
Note: For SDT, values withtin COMPDEV will be discarded.
-Note: For SDT, it is optional to set compression minimum COMPMIN, which is the
minimum time difference between stored values for purpose of noise reduction.
-Note: For SDT, it is optional to set compression maximum COMPMAX, which is the
maximum time difference between stored values regardless of COMPDEV.
+Note: For SDT, it is optional to set compression minimum COMPMINTIME, which is
the minimum time difference between stored values for purpose of noise
reduction.
+Note: For SDT, it is optional to set compression maximum COMPMAXTIME, which is
the maximum time difference between stored values regardless of COMPDEV.
```
* 删除时间序列语句
diff --git a/example/session/src/main/java/org/apache/iotdb/SessionExample.java
b/example/session/src/main/java/org/apache/iotdb/SessionExample.java
index d57d478..1dadd5d 100644
--- a/example/session/src/main/java/org/apache/iotdb/SessionExample.java
+++ b/example/session/src/main/java/org/apache/iotdb/SessionExample.java
@@ -107,13 +107,13 @@ public class SessionExample {
// create timeseries with SDT property, SDT will take place when flushing
if (!session.checkTimeseriesExists(ROOT_SG1_D1_S5)) {
- // compDev is required
- // compMax and compMin are optional and their unit is ms
+ // COMPDEV is required
+ // COMPMAXTIME and COMPMINTIME are optional and their unit is ms
Map<String, String> props = new HashMap<>();
- props.put("loss", "sdt");
- props.put("compDev", "0.01");
- props.put("compMin", "2");
- props.put("compMax", "10");
+ props.put("LOSS", "sdt");
+ props.put("COMPDEV", "0.01");
+ props.put("COMPMINTIME", "2");
+ props.put("COMPMAXTIME", "10");
session.createTimeseries(ROOT_SG1_D1_S5, TSDataType.INT64,
TSEncoding.RLE,
CompressionType.SNAPPY, props, null, null, null);
}
diff --git
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSimpleQueryIT.java
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSimpleQueryIT.java
index ec92978..b9c5661 100644
---
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSimpleQueryIT.java
+++
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSimpleQueryIT.java
@@ -108,7 +108,7 @@ public class IoTDBSimpleQueryIT {
statement.execute("SET STORAGE GROUP TO root.sg1");
//test set sdt property
statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH
DATATYPE=INT32,ENCODING=PLAIN,"
- + "LOSS=SDT,COMPDEV=2,COMPMIN=2,COMPMAX=10");
+ + "LOSS=SDT,COMPDEV=2,COMPMINTIME=2,COMPMAXTIME=10");
} catch (SQLException e) {
e.printStackTrace();
}
@@ -222,7 +222,7 @@ public class IoTDBSimpleQueryIT {
statement.execute("SET STORAGE GROUP TO root.sg1");
//test set sdt property
statement
- .execute("CREATE TIMESERIES root.sg1.d0.s0 WITH
DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMIN=1.5");
+ .execute("CREATE TIMESERIES root.sg1.d0.s0 WITH
DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMINTIME=1");
for (int time = 1; time < 8; time++) {
String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time +
",1)";
@@ -268,7 +268,7 @@ public class IoTDBSimpleQueryIT {
statement.execute("SET STORAGE GROUP TO root.sg1");
//test set sdt property
statement
- .execute("CREATE TIMESERIES root.sg1.d0.s0 WITH
DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMAX=20");
+ .execute("CREATE TIMESERIES root.sg1.d0.s0 WITH
DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMAXTIME=20");
for (int time = 1; time < 50; time++) {
String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time +
",1)";
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/SDTEncoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/SDTEncoder.java
index 88050db..55ef5b6 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/SDTEncoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/SDTEncoder.java
@@ -62,21 +62,21 @@ public class SDTEncoder {
/**
* the minimum time distance between two stored data points
- * if current point time to the last stored point time distance <= compMin,
+ * if current point time to the last stored point time distance <=
compMinTime,
* current point will NOT be stored regardless of compression deviation
*/
- private double compMin;
+ private long compMinTime ;
/**
* the maximum time distance between two stored data points
- * if current point time to the last stored point time distance >= compMax,
+ * if current point time to the last stored point time distance >=
compMaxTime,
* current point will be stored regardless of compression deviation
*/
- private double compMax;
+ private long compMaxTime;
/**
* isFirstValue is true when the encoder takes the first point or reset()
when cur point's
- * distance to the last stored point's distance exceeds compMax
+ * distance to the last stored point's distance exceeds compMaxTime
*/
private boolean isFirstValue;
@@ -84,8 +84,8 @@ public class SDTEncoder {
upperDoor = Integer.MIN_VALUE;
lowerDoor = Integer.MAX_VALUE;
compDeviation = -1;
- compMin = Integer.MIN_VALUE;
- compMax = Integer.MAX_VALUE;
+ compMinTime = 0;
+ compMaxTime = Long.MAX_VALUE;
isFirstValue = true;
}
@@ -96,15 +96,15 @@ public class SDTEncoder {
return true;
}
- // if current point to the last stored point's time distance is within
compMin,
- // will not check two doors nor store any point within the compMin time
range
- if (time - lastStoredTimestamp <= compMin) {
+ // if current point to the last stored point's time distance is within
compMinTime,
+ // will not check two doors nor store any point within the compMinTime
time range
+ if (time - lastStoredTimestamp <= compMinTime) {
return false;
}
- // if current point to the last stored point's time distance is larger
than compMax,
+ // if current point to the last stored point's time distance is larger
than compMaxTime,
// will reset two doors, and store current point;
- if (time - lastStoredTimestamp >= compMax) {
+ if (time - lastStoredTimestamp >= compMaxTime) {
reset(time, value);
return true;
}
@@ -141,15 +141,15 @@ public class SDTEncoder {
return true;
}
- // if current point to the last stored point's time distance is within
compMin,
- // will not check two doors nor store any point within the compMin time
range
- if (time - lastStoredTimestamp <= compMin) {
+ // if current point to the last stored point's time distance is within
compMinTime,
+ // will not check two doors nor store any point within the compMinTime
time range
+ if (time - lastStoredTimestamp <= compMinTime) {
return false;
}
- // if current point to the last stored point's time distance is larger
than compMax,
+ // if current point to the last stored point's time distance is larger
than compMaxTime,
// will reset two doors, and store current point;
- if (time - lastStoredTimestamp >= compMax) {
+ if (time - lastStoredTimestamp >= compMaxTime) {
reset(time, value);
return true;
}
@@ -186,15 +186,15 @@ public class SDTEncoder {
return true;
}
- // if current point to the last stored point's time distance is within
compMin,
- // will not check two doors nor store any point within the compMin time
range
- if (time - lastStoredTimestamp <= compMin) {
+ // if current point to the last stored point's time distance is within
compMinTime,
+ // will not check two doors nor store any point within the compMinTime
time range
+ if (time - lastStoredTimestamp <= compMinTime) {
return false;
}
- // if current point to the last stored point's time distance is larger
than compMax,
+ // if current point to the last stored point's time distance is larger
than compMaxTime,
// will reset two doors, and store current point;
- if (time - lastStoredTimestamp >= compMax) {
+ if (time - lastStoredTimestamp >= compMaxTime) {
reset(time, value);
return true;
}
@@ -231,15 +231,15 @@ public class SDTEncoder {
return true;
}
- // if current point to the last stored point's time distance is within
compMin,
- // will not check two doors nor store any point within the compMin time
range
- if (time - lastStoredTimestamp <= compMin) {
+ // if current point to the last stored point's time distance is within
compMinTime,
+ // will not check two doors nor store any point within the compMinTime
time range
+ if (time - lastStoredTimestamp <= compMinTime) {
return false;
}
- // if current point to the last stored point's time distance is larger
than compMax,
+ // if current point to the last stored point's time distance is larger
than compMaxTime,
// will reset two doors, and store current point;
- if (time - lastStoredTimestamp >= compMax) {
+ if (time - lastStoredTimestamp >= compMaxTime) {
reset(time, value);
return true;
}
@@ -373,7 +373,7 @@ public class SDTEncoder {
}
/**
- * if current point to the last stored point's time distance >= compMax,
will store current point
+ * if current point to the last stored point's time distance >= compMaxTime,
will store current point
* and reset upperDoor and lowerDoor
* @param time current time
* @param value current value
@@ -410,20 +410,20 @@ public class SDTEncoder {
return compDeviation;
}
- public void setCompMin(double compMin) {
- this.compMin = compMin;
+ public void setCompMinTime(long compMinTime) {
+ this.compMinTime = compMinTime;
}
- public double getCompMin() {
- return compMin;
+ public long getCompMinTime() {
+ return compMinTime;
}
- public void setCompMax(double compMax) {
- this.compMax = compMax;
+ public void setCompMaxTime(long compMaxTime) {
+ this.compMaxTime = compMaxTime;
}
- public double getCompMax() {
- return compMax;
+ public long getCompMaxTime() {
+ return compMaxTime;
}
public long getTime() {
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
index 80d4e9f..9a705f3 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
@@ -146,23 +146,23 @@ public class ChunkWriterImpl implements IChunkWriter {
}
}
- if (isSdtEncoding &&
measurementSchema.getProps().containsKey("compmin")) {
+ if (isSdtEncoding &&
measurementSchema.getProps().containsKey("compmintime")) {
try {
-
sdtEncoder.setCompMin(Double.parseDouble(measurementSchema.getProps().get("compmin")));
+
sdtEncoder.setCompMinTime(Long.parseLong(measurementSchema.getProps().get("compmintime")));
} catch (NumberFormatException e) {
logger.error("meet error when formatting SDT compression minimum");
}
}
- if (isSdtEncoding &&
measurementSchema.getProps().containsKey("compmax")) {
+ if (isSdtEncoding &&
measurementSchema.getProps().containsKey("compmaxtime")) {
try {
-
sdtEncoder.setCompMax(Double.parseDouble(measurementSchema.getProps().get("compmax")));
+
sdtEncoder.setCompMaxTime(Long.parseLong(measurementSchema.getProps().get("compmaxtime")));
} catch (NumberFormatException e) {
logger.error("meet error when formatting SDT compression maximum");
}
}
- if (isSdtEncoding && sdtEncoder.getCompMax() <= sdtEncoder.getCompMin())
{
+ if (isSdtEncoding && sdtEncoder.getCompMaxTime() <=
sdtEncoder.getCompMinTime()) {
logger
.error(
"SDT compression maximum needs to be greater than compression
minimum. SDT encoding is turned off");