From ce00b72ff8fc091d50bbc8bf726a9423c7c2b909 Mon Sep 17 00:00:00 2001 From: Leto_b Date: Tue, 10 Jun 2025 10:28:48 +0800 Subject: [PATCH 1/3] fix iotdb enterprise edition to timechodb --- src/UserGuide/Master/Table/Tools-System/Monitor-Tool_apache.md | 2 +- src/UserGuide/Master/Tree/Tools-System/Monitor-Tool_apache.md | 2 +- src/UserGuide/V1.3.x/Tools-System/Monitor-Tool_apache.md | 2 +- src/UserGuide/dev-1.3/Tools-System/Monitor-Tool_apache.md | 2 +- src/UserGuide/latest-Table/Tools-System/Monitor-Tool_apache.md | 2 +- src/UserGuide/latest/Tools-System/Monitor-Tool_apache.md | 2 +- .../UserGuide/Master/Table/Tools-System/Monitor-Tool_apache.md | 2 +- .../UserGuide/Master/Tree/Tools-System/Monitor-Tool_apache.md | 2 +- src/zh/UserGuide/V1.3.x/Tools-System/Monitor-Tool_apache.md | 2 +- src/zh/UserGuide/dev-1.3/Tools-System/Monitor-Tool_apache.md | 2 +- .../UserGuide/latest-Table/Tools-System/Monitor-Tool_apache.md | 2 +- src/zh/UserGuide/latest/Tools-System/Monitor-Tool_apache.md | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/UserGuide/Master/Table/Tools-System/Monitor-Tool_apache.md b/src/UserGuide/Master/Table/Tools-System/Monitor-Tool_apache.md index 4015009c1..dbd777aef 100644 --- a/src/UserGuide/Master/Table/Tools-System/Monitor-Tool_apache.md +++ b/src/UserGuide/Master/Table/Tools-System/Monitor-Tool_apache.md @@ -99,7 +99,7 @@ For more details, refer to the following documents: ## 4. Apache IoTDB Dashboard -The `Apache IoTDB Dashboard` is a companion product of IoTDB Enterprise Edition, supporting unified centralized operation and maintenance management. It allows monitoring multiple clusters through a single monitoring panel. You can contact the business team to obtain the Dashboard's JSON file. +The `Apache IoTDB Dashboard` is a companion product of TimechoDB, supporting unified centralized operation and maintenance management. It allows monitoring multiple clusters through a single monitoring panel. You can contact the business team to obtain the Dashboard's JSON file. ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/UserGuide/Master/Tree/Tools-System/Monitor-Tool_apache.md b/src/UserGuide/Master/Tree/Tools-System/Monitor-Tool_apache.md index fcb72d515..8699179cb 100644 --- a/src/UserGuide/Master/Tree/Tools-System/Monitor-Tool_apache.md +++ b/src/UserGuide/Master/Tree/Tools-System/Monitor-Tool_apache.md @@ -109,7 +109,7 @@ The following documents may help you have a good journey with Prometheus and Gra ## 2. Apache IoTDB Dashboard -`Apache IoTDB Dashboard` is available as a supplement to IoTDB Enterprise Edition, designed for unified centralized operations and management. With it, multiple clusters can be monitored through a single panel. You can access the Dashboard's Json file by contacting Commerce. +`Apache IoTDB Dashboard` is available as a supplement to TimechoDB, designed for unified centralized operations and management. With it, multiple clusters can be monitored through a single panel. You can access the Dashboard's Json file by contacting Commerce. ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/UserGuide/V1.3.x/Tools-System/Monitor-Tool_apache.md b/src/UserGuide/V1.3.x/Tools-System/Monitor-Tool_apache.md index 9aa65e5dd..956ec134e 100644 --- a/src/UserGuide/V1.3.x/Tools-System/Monitor-Tool_apache.md +++ b/src/UserGuide/V1.3.x/Tools-System/Monitor-Tool_apache.md @@ -109,7 +109,7 @@ The following documents may help you have a good journey with Prometheus and Gra ## Apache IoTDB Dashboard -`Apache IoTDB Dashboard` is available as a supplement to IoTDB Enterprise Edition, designed for unified centralized operations and management. With it, multiple clusters can be monitored through a single panel. You can access the Dashboard's Json file by contacting Commerce. +`Apache IoTDB Dashboard` is available as a supplement to TimechoDB, designed for unified centralized operations and management. With it, multiple clusters can be monitored through a single panel. You can access the Dashboard's Json file by contacting Commerce. ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/UserGuide/dev-1.3/Tools-System/Monitor-Tool_apache.md b/src/UserGuide/dev-1.3/Tools-System/Monitor-Tool_apache.md index 9aa65e5dd..956ec134e 100644 --- a/src/UserGuide/dev-1.3/Tools-System/Monitor-Tool_apache.md +++ b/src/UserGuide/dev-1.3/Tools-System/Monitor-Tool_apache.md @@ -109,7 +109,7 @@ The following documents may help you have a good journey with Prometheus and Gra ## Apache IoTDB Dashboard -`Apache IoTDB Dashboard` is available as a supplement to IoTDB Enterprise Edition, designed for unified centralized operations and management. With it, multiple clusters can be monitored through a single panel. You can access the Dashboard's Json file by contacting Commerce. +`Apache IoTDB Dashboard` is available as a supplement to TimechoDB, designed for unified centralized operations and management. With it, multiple clusters can be monitored through a single panel. You can access the Dashboard's Json file by contacting Commerce. ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/UserGuide/latest-Table/Tools-System/Monitor-Tool_apache.md b/src/UserGuide/latest-Table/Tools-System/Monitor-Tool_apache.md index 4015009c1..dbd777aef 100644 --- a/src/UserGuide/latest-Table/Tools-System/Monitor-Tool_apache.md +++ b/src/UserGuide/latest-Table/Tools-System/Monitor-Tool_apache.md @@ -99,7 +99,7 @@ For more details, refer to the following documents: ## 4. Apache IoTDB Dashboard -The `Apache IoTDB Dashboard` is a companion product of IoTDB Enterprise Edition, supporting unified centralized operation and maintenance management. It allows monitoring multiple clusters through a single monitoring panel. You can contact the business team to obtain the Dashboard's JSON file. +The `Apache IoTDB Dashboard` is a companion product of TimechoDB, supporting unified centralized operation and maintenance management. It allows monitoring multiple clusters through a single monitoring panel. You can contact the business team to obtain the Dashboard's JSON file. ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/UserGuide/latest/Tools-System/Monitor-Tool_apache.md b/src/UserGuide/latest/Tools-System/Monitor-Tool_apache.md index fcb72d515..8699179cb 100644 --- a/src/UserGuide/latest/Tools-System/Monitor-Tool_apache.md +++ b/src/UserGuide/latest/Tools-System/Monitor-Tool_apache.md @@ -109,7 +109,7 @@ The following documents may help you have a good journey with Prometheus and Gra ## 2. Apache IoTDB Dashboard -`Apache IoTDB Dashboard` is available as a supplement to IoTDB Enterprise Edition, designed for unified centralized operations and management. With it, multiple clusters can be monitored through a single panel. You can access the Dashboard's Json file by contacting Commerce. +`Apache IoTDB Dashboard` is available as a supplement to TimechoDB, designed for unified centralized operations and management. With it, multiple clusters can be monitored through a single panel. You can access the Dashboard's Json file by contacting Commerce. ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/zh/UserGuide/Master/Table/Tools-System/Monitor-Tool_apache.md b/src/zh/UserGuide/Master/Table/Tools-System/Monitor-Tool_apache.md index 46a49d8de..199a1d1ca 100644 --- a/src/zh/UserGuide/Master/Table/Tools-System/Monitor-Tool_apache.md +++ b/src/zh/UserGuide/Master/Table/Tools-System/Monitor-Tool_apache.md @@ -104,7 +104,7 @@ static_configs: ## 4. Apache IoTDB Dashboard -`Apache IoTDB Dashboard`是 IoTDB 企业版的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 +`Apache IoTDB Dashboard`是 TimechoDB 的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/zh/UserGuide/Master/Tree/Tools-System/Monitor-Tool_apache.md b/src/zh/UserGuide/Master/Tree/Tools-System/Monitor-Tool_apache.md index 12b023767..731f3179e 100644 --- a/src/zh/UserGuide/Master/Tree/Tools-System/Monitor-Tool_apache.md +++ b/src/zh/UserGuide/Master/Tree/Tools-System/Monitor-Tool_apache.md @@ -104,7 +104,7 @@ static_configs: ## 4. Apache IoTDB Dashboard -`Apache IoTDB Dashboard`是 IoTDB 企业版的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 +`Apache IoTDB Dashboard`是 TimechoDB 的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/zh/UserGuide/V1.3.x/Tools-System/Monitor-Tool_apache.md b/src/zh/UserGuide/V1.3.x/Tools-System/Monitor-Tool_apache.md index 3ef0730da..16023f4e8 100644 --- a/src/zh/UserGuide/V1.3.x/Tools-System/Monitor-Tool_apache.md +++ b/src/zh/UserGuide/V1.3.x/Tools-System/Monitor-Tool_apache.md @@ -104,7 +104,7 @@ static_configs: ## Apache IoTDB Dashboard -`Apache IoTDB Dashboard`是 IoTDB 企业版的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 +`Apache IoTDB Dashboard`是 TimechoDB 的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/zh/UserGuide/dev-1.3/Tools-System/Monitor-Tool_apache.md b/src/zh/UserGuide/dev-1.3/Tools-System/Monitor-Tool_apache.md index 3ef0730da..16023f4e8 100644 --- a/src/zh/UserGuide/dev-1.3/Tools-System/Monitor-Tool_apache.md +++ b/src/zh/UserGuide/dev-1.3/Tools-System/Monitor-Tool_apache.md @@ -104,7 +104,7 @@ static_configs: ## Apache IoTDB Dashboard -`Apache IoTDB Dashboard`是 IoTDB 企业版的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 +`Apache IoTDB Dashboard`是 TimechoDB 的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/zh/UserGuide/latest-Table/Tools-System/Monitor-Tool_apache.md b/src/zh/UserGuide/latest-Table/Tools-System/Monitor-Tool_apache.md index 46a49d8de..199a1d1ca 100644 --- a/src/zh/UserGuide/latest-Table/Tools-System/Monitor-Tool_apache.md +++ b/src/zh/UserGuide/latest-Table/Tools-System/Monitor-Tool_apache.md @@ -104,7 +104,7 @@ static_configs: ## 4. Apache IoTDB Dashboard -`Apache IoTDB Dashboard`是 IoTDB 企业版的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 +`Apache IoTDB Dashboard`是 TimechoDB 的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) diff --git a/src/zh/UserGuide/latest/Tools-System/Monitor-Tool_apache.md b/src/zh/UserGuide/latest/Tools-System/Monitor-Tool_apache.md index 12b023767..731f3179e 100644 --- a/src/zh/UserGuide/latest/Tools-System/Monitor-Tool_apache.md +++ b/src/zh/UserGuide/latest/Tools-System/Monitor-Tool_apache.md @@ -104,7 +104,7 @@ static_configs: ## 4. Apache IoTDB Dashboard -`Apache IoTDB Dashboard`是 IoTDB 企业版的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 +`Apache IoTDB Dashboard`是 TimechoDB 的配套产品,支持统一集中式运维管理,可通过一个监控面板监控多个集群。你可以联系商务获取到 Dashboard 的 Json文件。 ![Apache IoTDB Dashboard](/img/%E7%9B%91%E6%8E%A7%20default%20cluster.png) From 570b4bcd7900c8df648164f0cfcedc6ab190485a Mon Sep 17 00:00:00 2001 From: Leto_b Date: Tue, 10 Jun 2025 11:08:54 +0800 Subject: [PATCH 2/3] add support version to minby and maxby --- .../SQL-Manual/Function-and-Expression.md | 228 ++++++++++++++++-- .../SQL-Manual/Operator-and-Expression.md | 16 +- .../SQL-Manual/Function-and-Expression.md | 227 +++++++++++++++-- .../SQL-Manual/Operator-and-Expression.md | 4 +- .../SQL-Manual/Function-and-Expression.md | 47 ++-- .../SQL-Manual/Operator-and-Expression.md | 40 +-- .../SQL-Manual/Function-and-Expression.md | 5 +- .../SQL-Manual/Operator-and-Expression.md | 4 +- 8 files changed, 474 insertions(+), 97 deletions(-) diff --git a/src/UserGuide/V1.3.x/SQL-Manual/Function-and-Expression.md b/src/UserGuide/V1.3.x/SQL-Manual/Function-and-Expression.md index c208d6f17..0f41d2548 100644 --- a/src/UserGuide/V1.3.x/SQL-Manual/Function-and-Expression.md +++ b/src/UserGuide/V1.3.x/SQL-Manual/Function-and-Expression.md @@ -539,6 +539,12 @@ The aggregate functions supported by IoTDB are as follows: | SUM | Summation. | INT32 INT64 FLOAT DOUBLE | / | DOUBLE | | COUNT | Counts the number of data points. | All data types | / | INT | | AVG | Average. | INT32 INT64 FLOAT DOUBLE | / | DOUBLE | + STDDEV | Alias for STDDEV_SAMP. Return the sample standard deviation. | INT32 INT64 FLOAT DOUBLE | / | DOUBLE | +| STDDEV_POP | Return the population standard deviation. | INT32 INT64 FLOAT DOUBLE | / | DOUBLE | +| STDDEV_SAMP | Return the sample standard deviation. | INT32 INT64 FLOAT DOUBLE | / | DOUBLE | +| VARIANCE | Alias for VAR_SAMP. Return the sample variance. | INT32 INT64 FLOAT DOUBLE | / | DOUBLE | +| VAR_POP | Return the population variance. | INT32 INT64 FLOAT DOUBLE | / | DOUBLE | +| VAR_SAMP | Return the sample variance. | INT32 INT64 FLOAT DOUBLE | / | DOUBLE | | EXTREME | Finds the value with the largest absolute value. Returns a positive value if the maximum absolute value of positive and negative values is equal. | INT32 INT64 FLOAT DOUBLE | / | Consistent with the input data type | | MAX_VALUE | Find the maximum value. | INT32 INT64 FLOAT DOUBLE | / | Consistent with the input data type | | MIN_VALUE | Find the minimum value. | INT32 INT64 FLOAT DOUBLE | / | Consistent with the input data type | @@ -549,29 +555,11 @@ The aggregate functions supported by IoTDB are as follows: | COUNT_IF | Find the number of data points that continuously meet a given condition and the number of data points that meet the condition (represented by keep) meet the specified threshold. | BOOLEAN | `[keep >=/>/=/!=/= threshold` if `threshold` is used alone, type of `threshold` is `INT64` `ignoreNull`:Optional, default value is `true`;If the value is `true`, null values are ignored, it means that if there is a null value in the middle, the value is ignored without interrupting the continuity. If the value is `true`, null values are not ignored, it means that if there are null values in the middle, continuity will be broken | INT64 | | TIME_DURATION | Find the difference between the timestamp of the largest non-null value and the timestamp of the smallest non-null value in a column | All data Types | / | INT64 | | MODE | Find the mode. Note: 1.Having too many different values in the input series risks a memory exception; 2.If all the elements have the same number of occurrences, that is no Mode, return the value with earliest time; 3.If there are many Modes, return the Mode with earliest time. | All data Types | / | Consistent with the input data type | -| STDDEV | Calculate the overall standard deviation of the data. Note:
Missing points, null points and `NaN` in the input series will be ignored.| INT32 INT64 FLOAT DOUBLE | / | DOUBLE | | COUNT_TIME | The number of timestamps in the query data set. When used with `align by device`, the result is the number of timestamps in the data set per device. | All data Types, the input parameter can only be `*` | / | INT64 | +| MAX_BY | MAX_BY(x, y) returns the value of x corresponding to the maximum value of the input y. MAX_BY(time, x) returns the timestamp when x is at its maximum value.
Note: Supported from version V1.3.2 | The first input x can be of any type, while the second input y must be of type INT32, INT64, FLOAT, DOUBLE, STRING, TIMESTAMP or DATE. | / | Consistent with the data type of the first input x. | +| MIN_BY | MIN_BY(x, y) returns the value of x corresponding to the minimum value of the input y. MIN_BY(time, x) returns the timestamp when x is at its minimum value.
Note: Supported from version V1.3.2 | The first input x can be of any type, while the second input y must be of type INT32, INT64, FLOAT, DOUBLE, STRING, TIMESTAMP or DATE. | / | Consistent with the data type of the first input x. | -### COUNT - -#### example - -```sql -select count(status) from root.ln.wf01.wt01; -``` -Result: - -``` -+-------------------------------+ -|count(root.ln.wf01.wt01.status)| -+-------------------------------+ -| 10080| -+-------------------------------+ -Total line number = 1 -It costs 0.016s -``` - ### COUNT_IF #### Grammar @@ -800,6 +788,206 @@ Result > 3. Count_time aggregation used with having statement is not supported, and count_time aggregation can not appear in the having statement. > 4. Count_time does not support use with group by level, group by tag. + + + +### MAX_BY + +#### Function Definition +`max_by(x, y)`: Returns the value of x at the timestamp where y reaches its maximum. + +- `max_by` must have two input parameters x and y. +- The first input can be the time keyword. `max_by(time, x)` returns the timestamp when x reaches its maximum value. +- Returns null if x is null at the timestamp where y is maximum. +- If y achieves its maximum at multiple timestamps, returns the x value at the smallest timestamp among them. +- Aligns with IoTDB's `max_value`: Only supports INT32, INT64, FLOAT, DOUBLE as y input. Supports all six data types as x input. +- Inputs x and y cannot be literal values. + +#### Syntax +```sql +select max_by(x, y) from root.sg +select max_by(time, x) from root.sg +``` + +#### Examples + +##### Raw Data +```sql +IoTDB> select * from root.test ++-----------------------------+-----------+-----------+ +| Time|root.test.a|root.test.b| ++-----------------------------+-----------+-----------+ +|1970-01-01T08:00:00.001+08:00| 1.0| 10.0| +|1970-01-01T08:00:00.002+08:00| 2.0| 10.0| +|1970-01-01T08:00:00.003+08:00| 3.0| 3.0| +|1970-01-01T08:00:00.004+08:00| 10.0| 10.0| +|1970-01-01T08:00:00.005+08:00| 10.0| 12.0| +|1970-01-01T08:00:00.006+08:00| 6.0| 6.0| ++-----------------------------+-----------+-----------+ +``` +##### Query Examples +Get timestamp corresponding to maximum value: +```sql +IoTDB> select max_by(time, a), max_value(a) from root.test ++-------------------------+------------------------+ +|max_by(Time, root.test.a)| max_value(root.test.a)| ++-------------------------+------------------------+ +| 4| 10.0| ++-------------------------+------------------------+ +``` + +Get b value when a is maximum: +```sql +IoTDB> select max_by(b, a) from root.test ++--------------------------------+ +|max_by(root.test.b, root.test.a)| ++--------------------------------+ +| 10.0| ++--------------------------------+ +``` + +With expressions: +```sql +IoTDB> select max_by(b + 1, a * 2) from root.test ++----------------------------------------+ +|max_by(root.test.b + 1, root.test.a * 2)| ++----------------------------------------+ +| 11.0| ++----------------------------------------+ +``` + +With GROUP BY TIME clause: +```sql +IoTDB> select max_by(b, a) from root.test group by ([0,7),4ms) ++-----------------------------+--------------------------------+ +| Time|max_by(root.test.b, root.test.a)| ++-----------------------------+--------------------------------+ +|1970-01-01T08:00:00.000+08:00| 3.0| ++-----------------------------+--------------------------------+ +|1970-01-01T08:00:00.004+08:00| 10.0| ++-----------------------------+--------------------------------+ +``` + +With HAVING clause: +```sql +IoTDB> select max_by(b, a) from root.test group by ([0,7),4ms) having max_by(b, a) > 4.0 ++-----------------------------+--------------------------------+ +| Time|max_by(root.test.b, root.test.a)| ++-----------------------------+--------------------------------+ +|1970-01-01T08:00:00.004+08:00| 10.0| ++-----------------------------+--------------------------------+ +``` +With ORDER BY clause: +```sql +IoTDB> select max_by(b, a) from root.test group by ([0,7),4ms) order by time desc ++-----------------------------+--------------------------------+ +| Time|max_by(root.test.b, root.test.a)| ++-----------------------------+--------------------------------+ +|1970-01-01T08:00:00.004+08:00| 10.0| ++-----------------------------+--------------------------------+ +|1970-01-01T08:00:00.000+08:00| 3.0| ++-----------------------------+--------------------------------+ +``` + +### MIN_BY +#### Function Definition +`min_by(x, y)`: Returns the value of x at the timestamp where y reaches its minimum. + +- `min_by` must have two input parameters x and y. +- The first input can be the time keyword. `min_by(time, x)` returns the timestamp when x reaches its minimum value. +- Returns null if x is null at the timestamp where y is minimum. +- If y achieves its minimum at multiple timestamps, returns the x value at the smallest timestamp among them. +- Aligns with IoTDB's `min_value`: Only supports INT32, INT64, FLOAT, DOUBLE as y input. Supports all six data types as x input. +- Inputs x and y cannot be literal values. + +#### Syntax +```sql +select min_by(x, y) from root.sg +select min_by(time, x) from root.sg +``` + +#### Examples + +##### Raw Data +```sql +IoTDB> select * from root.test ++-----------------------------+-----------+-----------+ +| Time|root.test.a|root.test.b| ++-----------------------------+-----------+-----------+ +|1970-01-01T08:00:00.001+08:00| 4.0| 10.0| +|1970-01-01T08:00:00.002+08:00| 3.0| 10.0| +|1970-01-01T08:00:00.003+08:00| 2.0| 3.0| +|1970-01-01T08:00:00.004+08:00| 1.0| 10.0| +|1970-01-01T08:00:00.005+08:00| 1.0| 12.0| +|1970-01-01T08:00:00.006+08:00| 6.0| 6.0| ++-----------------------------+-----------+-----------+ +``` +##### Query Examples +Get timestamp corresponding to minimum value: +```sql +IoTDB> select min_by(time, a), min_value(a) from root.test ++-------------------------+------------------------+ +|min_by(Time, root.test.a)| min_value(root.test.a)| ++-------------------------+------------------------+ +| 4| 1.0| ++-------------------------+------------------------+ +``` + +Get b value when a is minimum: +```sql +IoTDB> select min_by(b, a) from root.test ++--------------------------------+ +|min_by(root.test.b, root.test.a)| ++--------------------------------+ +| 10.0| ++--------------------------------+ +``` + +With expressions: +```sql +IoTDB> select min_by(b + 1, a * 2) from root.test ++----------------------------------------+ +|min_by(root.test.b + 1, root.test.a * 2)| ++----------------------------------------+ +| 11.0| ++----------------------------------------+ +``` + +With GROUP BY TIME clause: +```sql +IoTDB> select min_by(b, a) from root.test group by ([0,7),4ms) ++-----------------------------+--------------------------------+ +| Time|min_by(root.test.b, root.test.a)| ++-----------------------------+--------------------------------+ +|1970-01-01T08:00:00.000+08:00| 3.0| ++-----------------------------+--------------------------------+ +|1970-01-01T08:00:00.004+08:00| 10.0| ++-----------------------------+--------------------------------+ +``` + +With HAVING clause: +```sql +IoTDB> select min_by(b, a) from root.test group by ([0,7),4ms) having max_by(b, a) > 4.0 ++-----------------------------+--------------------------------+ +| Time|min_by(root.test.b, root.test.a)| ++-----------------------------+--------------------------------+ +|1970-01-01T08:00:00.004+08:00| 10.0| ++-----------------------------+--------------------------------+ +``` + +With ORDER BY clause: +```sql +IoTDB> select min_by(b, a) from root.test group by ([0,7),4ms) order by time desc ++-----------------------------+--------------------------------+ +| Time|min_by(root.test.b, root.test.a)| ++-----------------------------+--------------------------------+ +|1970-01-01T08:00:00.004+08:00| 10.0| ++-----------------------------+--------------------------------+ +|1970-01-01T08:00:00.000+08:00| 3.0| ++-----------------------------+--------------------------------+ +``` + +