This is an automated email from the ASF dual-hosted git repository.
critas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iotdb-docs.git
The following commit(s) were added to refs/heads/main by this push:
new 7c3f30d2 Multi device downsampling alignment query (#753)
7c3f30d2 is described below
commit 7c3f30d223734ee34c005b76130def55a13a481a
Author: W1y1r <[email protected]>
AuthorDate: Wed May 21 14:15:07 2025 +0800
Multi device downsampling alignment query (#753)
---
.../Master/Table/Basic-Concept/Query-Data.md | 29 +++++++++++++++++++++-
.../Master/Table/SQL-Manual/Nested-Queries.md | 2 +-
.../latest-Table/Basic-Concept/Query-Data.md | 28 ++++++++++++++++++++-
.../latest-Table/SQL-Manual/Nested-Queries.md | 2 +-
.../Master/Table/Basic-Concept/Query-Data.md | 29 +++++++++++++++++++++-
.../Master/Table/SQL-Manual/Nested-Queries.md | 2 +-
.../latest-Table/Basic-Concept/Query-Data.md | 29 +++++++++++++++++++++-
.../latest-Table/SQL-Manual/Nested-Queries.md | 2 +-
8 files changed, 115 insertions(+), 8 deletions(-)
diff --git a/src/UserGuide/Master/Table/Basic-Concept/Query-Data.md
b/src/UserGuide/Master/Table/Basic-Concept/Query-Data.md
index 007ecfba..6f870740 100644
--- a/src/UserGuide/Master/Table/Basic-Concept/Query-Data.md
+++ b/src/UserGuide/Master/Table/Basic-Concept/Query-Data.md
@@ -140,6 +140,33 @@ Total line number = 7
It costs 0.106s
```
+**Example 3:Multi device time aligned query**
+
+```SQL
+IoTDB> SELECT date_bin_gapfill(1d, TIME) AS a_time,
+ device_id,
+ AVG(temperature) AS avg_temp
+ FROM table1
+ WHERE TIME >= 2024-11-26 13:00:00
+ AND TIME <= 2024-11-27 17:00:00
+ GROUP BY 1, device_id FILL METHOD PREVIOUS;
+```
+
+**Result**:
+
+```SQL
++-----------------------------+---------+--------+
+| a_time|device_id|avg_temp|
++-----------------------------+---------+--------+
+|2024-11-26T08:00:00.000+08:00| 100| 90.0|
+|2024-11-27T08:00:00.000+08:00| 100| 90.0|
+|2024-11-26T08:00:00.000+08:00| 101| 90.0|
+|2024-11-27T08:00:00.000+08:00| 101| 85.0|
++-----------------------------+---------+--------+
+Total line number = 4
+It costs 0.048s
+```
+
### 3.3 Aggregation Query
**Example**: Calculate the average, maximum, and minimum temperature for each
`device_id` within a specific time range.
@@ -213,7 +240,7 @@ IoTDB> SELECT device_id,date_bin(1d ,time) as day_time,
AVG(temperature) as avg_
Total line number = 5
It costs 0.066s
```
-### 3.6 Multi sequence downsampling query with misaligned timestamps
+### 3.6 Multi device downsampling alignment query
#### 3.6.1 Sampling Frequency is the Same, but Time is Different
diff --git a/src/UserGuide/Master/Table/SQL-Manual/Nested-Queries.md
b/src/UserGuide/Master/Table/SQL-Manual/Nested-Queries.md
index d0fa7cb4..89f9124d 100644
--- a/src/UserGuide/Master/Table/SQL-Manual/Nested-Queries.md
+++ b/src/UserGuide/Master/Table/SQL-Manual/Nested-Queries.md
@@ -878,4 +878,4 @@ Note:
**Example:**
-* Downsampling queries for multiple sequences with misaligned timestamps. For
detailed examples, see:
[Example](../Basic-Concept/Query-Data.md#36-multi-sequence-downsampling-query-with-misaligned-timestamps)
+* * Multi device downsampling alignment query. For detailed examples, see:
[Example](../Basic-Concept/Query-Data.md#36-multi-device-downsampling-alignment-query)
diff --git a/src/UserGuide/latest-Table/Basic-Concept/Query-Data.md
b/src/UserGuide/latest-Table/Basic-Concept/Query-Data.md
index 007ecfba..2a450e73 100644
--- a/src/UserGuide/latest-Table/Basic-Concept/Query-Data.md
+++ b/src/UserGuide/latest-Table/Basic-Concept/Query-Data.md
@@ -139,6 +139,32 @@ IoTDB> SELECT time, temperature, humidity
Total line number = 7
It costs 0.106s
```
+**Example 3:Multi device time aligned query**
+
+```SQL
+IoTDB> SELECT date_bin_gapfill(1d, TIME) AS a_time,
+ device_id,
+ AVG(temperature) AS avg_temp
+ FROM table1
+ WHERE TIME >= 2024-11-26 13:00:00
+ AND TIME <= 2024-11-27 17:00:00
+ GROUP BY 1, device_id FILL METHOD PREVIOUS;
+```
+
+**Result**:
+
+```SQL
++-----------------------------+---------+--------+
+| a_time|device_id|avg_temp|
++-----------------------------+---------+--------+
+|2024-11-26T08:00:00.000+08:00| 100| 90.0|
+|2024-11-27T08:00:00.000+08:00| 100| 90.0|
+|2024-11-26T08:00:00.000+08:00| 101| 90.0|
+|2024-11-27T08:00:00.000+08:00| 101| 85.0|
++-----------------------------+---------+--------+
+Total line number = 4
+It costs 0.048s
+```
### 3.3 Aggregation Query
@@ -213,7 +239,7 @@ IoTDB> SELECT device_id,date_bin(1d ,time) as day_time,
AVG(temperature) as avg_
Total line number = 5
It costs 0.066s
```
-### 3.6 Multi sequence downsampling query with misaligned timestamps
+### 3.6 Multi device downsampling alignment query
#### 3.6.1 Sampling Frequency is the Same, but Time is Different
diff --git a/src/UserGuide/latest-Table/SQL-Manual/Nested-Queries.md
b/src/UserGuide/latest-Table/SQL-Manual/Nested-Queries.md
index b564c878..490799e3 100644
--- a/src/UserGuide/latest-Table/SQL-Manual/Nested-Queries.md
+++ b/src/UserGuide/latest-Table/SQL-Manual/Nested-Queries.md
@@ -878,4 +878,4 @@ Note:
**Example:**
-* Downsampling queries for multiple sequences with misaligned timestamps. For
detailed examples, see:
[Example](../Basic-Concept/Query-Data.md#36-multi-sequence-downsampling-query-with-misaligned-timestamps)
\ No newline at end of file
+* Multi device downsampling alignment query. For detailed examples, see:
[Example](../Basic-Concept/Query-Data.md#36-multi-device-downsampling-alignment-query)
\ No newline at end of file
diff --git a/src/zh/UserGuide/Master/Table/Basic-Concept/Query-Data.md
b/src/zh/UserGuide/Master/Table/Basic-Concept/Query-Data.md
index 3ceb0970..415d62e5 100644
--- a/src/zh/UserGuide/Master/Table/Basic-Concept/Query-Data.md
+++ b/src/zh/UserGuide/Master/Table/Basic-Concept/Query-Data.md
@@ -141,6 +141,33 @@ Total line number = 7
It costs 0.106s
```
+**示例4:多设备按时间对齐查询**
+
+```SQL
+IoTDB> SELECT date_bin_gapfill(1d, TIME) AS a_time,
+ device_id,
+ AVG(temperature) AS avg_temp
+ FROM table1
+ WHERE TIME >= 2024-11-26 13:00:00
+ AND TIME <= 2024-11-27 17:00:00
+ GROUP BY 1, device_id FILL METHOD PREVIOUS;
+```
+
+执行结果如下:
+
+```SQL
++-----------------------------+---------+--------+
+| a_time|device_id|avg_temp|
++-----------------------------+---------+--------+
+|2024-11-26T08:00:00.000+08:00| 100| 90.0|
+|2024-11-27T08:00:00.000+08:00| 100| 90.0|
+|2024-11-26T08:00:00.000+08:00| 101| 90.0|
+|2024-11-27T08:00:00.000+08:00| 101| 85.0|
++-----------------------------+---------+--------+
+Total line number = 4
+It costs 0.048s
+```
+
### 3.3 聚合查询
**示例:查询计算了在指定时间范围内,每个`device_id`的平均温度、最高温度和最低温度。**
@@ -215,7 +242,7 @@ Total line number = 5
It costs 0.066s
```
-### 3.6 时间戳不对齐的多序列降采样查询
+### 3.6 多设备降采样对齐查询
#### 3.6.1 采样频率相同,时间不同
diff --git a/src/zh/UserGuide/Master/Table/SQL-Manual/Nested-Queries.md
b/src/zh/UserGuide/Master/Table/SQL-Manual/Nested-Queries.md
index f989585f..4f44b43b 100644
--- a/src/zh/UserGuide/Master/Table/SQL-Manual/Nested-Queries.md
+++ b/src/zh/UserGuide/Master/Table/SQL-Manual/Nested-Queries.md
@@ -877,4 +877,4 @@ IoTDB> SELECT s1 <=
**示例:**
-*
时间戳不对齐的多序列降采样查询,详细示例可见:[示例](../Basic-Concept/Query-Data.md#36-时间戳不对齐的多序列降采样查询)
\ No newline at end of file
+* 多设备降采样对齐查询,详细示例可见:[示例](../Basic-Concept/Query-Data.md#36-多设备降采样对齐查询)
\ No newline at end of file
diff --git a/src/zh/UserGuide/latest-Table/Basic-Concept/Query-Data.md
b/src/zh/UserGuide/latest-Table/Basic-Concept/Query-Data.md
index 3ceb0970..415d62e5 100644
--- a/src/zh/UserGuide/latest-Table/Basic-Concept/Query-Data.md
+++ b/src/zh/UserGuide/latest-Table/Basic-Concept/Query-Data.md
@@ -141,6 +141,33 @@ Total line number = 7
It costs 0.106s
```
+**示例4:多设备按时间对齐查询**
+
+```SQL
+IoTDB> SELECT date_bin_gapfill(1d, TIME) AS a_time,
+ device_id,
+ AVG(temperature) AS avg_temp
+ FROM table1
+ WHERE TIME >= 2024-11-26 13:00:00
+ AND TIME <= 2024-11-27 17:00:00
+ GROUP BY 1, device_id FILL METHOD PREVIOUS;
+```
+
+执行结果如下:
+
+```SQL
++-----------------------------+---------+--------+
+| a_time|device_id|avg_temp|
++-----------------------------+---------+--------+
+|2024-11-26T08:00:00.000+08:00| 100| 90.0|
+|2024-11-27T08:00:00.000+08:00| 100| 90.0|
+|2024-11-26T08:00:00.000+08:00| 101| 90.0|
+|2024-11-27T08:00:00.000+08:00| 101| 85.0|
++-----------------------------+---------+--------+
+Total line number = 4
+It costs 0.048s
+```
+
### 3.3 聚合查询
**示例:查询计算了在指定时间范围内,每个`device_id`的平均温度、最高温度和最低温度。**
@@ -215,7 +242,7 @@ Total line number = 5
It costs 0.066s
```
-### 3.6 时间戳不对齐的多序列降采样查询
+### 3.6 多设备降采样对齐查询
#### 3.6.1 采样频率相同,时间不同
diff --git a/src/zh/UserGuide/latest-Table/SQL-Manual/Nested-Queries.md
b/src/zh/UserGuide/latest-Table/SQL-Manual/Nested-Queries.md
index f989585f..4f44b43b 100644
--- a/src/zh/UserGuide/latest-Table/SQL-Manual/Nested-Queries.md
+++ b/src/zh/UserGuide/latest-Table/SQL-Manual/Nested-Queries.md
@@ -877,4 +877,4 @@ IoTDB> SELECT s1 <=
**示例:**
-*
时间戳不对齐的多序列降采样查询,详细示例可见:[示例](../Basic-Concept/Query-Data.md#36-时间戳不对齐的多序列降采样查询)
\ No newline at end of file
+* 多设备降采样对齐查询,详细示例可见:[示例](../Basic-Concept/Query-Data.md#36-多设备降采样对齐查询)
\ No newline at end of file