Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 94 additions & 23 deletions src/UserGuide/Master/Tree/SQL-Manual/UDF-Libraries_apache.md
Original file line number Diff line number Diff line change
Expand Up @@ -3535,7 +3535,97 @@ Output series:
+-----------------------------+-------------------------------------+
```

### 5.4 FFT
### 5.4 IDWT

#### Registration statement

```sql
create function dwt as 'org.apache.iotdb.library.frequency.UDTFIDWT'
```

#### Usage

This function performs one-dimensional inverse discrete wavelet transform on the input series, reconstructing the original data from DWT decomposed wavelet coefficients.

**Name:** IDWT

**Input:** Only support a single input series. The type is INT32 / INT64 / FLOAT / DOUBLE.

**Parameters:**

+ `method`: The type of wavelet. May select 'Haar', 'DB4', 'DB6', 'DB8', where DB means Daubechies. User may offer coefficients of wavelet transform and ignore this parameter. Case ignored.
+ `coef`: Coefficients of wavelet transform. When providing this parameter, use comma ',' to split them, and leave no spaces or other punctuations.
+ `layer`: Times to transform. The number of output vectors equals $layer+1$. Default is 1.

**Output:** Output a single series. The type is DOUBLE. The length is the same as the input.

**Note:**
* The length of input series must be an integer number power of 2.
* The parameter settings of the IDWT function (method/coef/layer) should be consistent with the corresponding DWT transformation to correctly reconstruct the original data.
* Typically, the input of IDWT is the output result of the DWT function.

#### Examples

##### Haar wavelet transform

Input series:

```
+-----------------------------+--------------------+
| Time| root.test.d1.s2|
+-----------------------------+--------------------+
|1970-01-01T08:00:00.000+08:00| 0.1414213562373095|
|1970-01-01T08:00:00.100+08:00| 1.909188309203678|
|1970-01-01T08:00:00.200+08:00| 1.6263455967290592|
|1970-01-01T08:00:00.300+08:00| 1.979898987322333|
|1970-01-01T08:00:00.400+08:00| 3.2526911934581184|
|1970-01-01T08:00:00.500+08:00| 1.414213562373095|
|1970-01-01T08:00:00.600+08:00| 2.1213203435596424|
|1970-01-01T08:00:00.700+08:00| 1.8384776310850235|
|1970-01-01T08:00:00.800+08:00| -0.1414213562373095|
|1970-01-01T08:00:00.900+08:00| 0.21213203435596428|
|1970-01-01T08:00:01.000+08:00| -0.7778174593052022|
|1970-01-01T08:00:01.100+08:00| -0.8485281374238569|
|1970-01-01T08:00:01.200+08:00| 0.2828427124746189|
|1970-01-01T08:00:01.300+08:00| -1.414213562373095|
|1970-01-01T08:00:01.400+08:00| 0.42426406871192857|
|1970-01-01T08:00:01.500+08:00|-0.42426406871192857|
+-----------------------------+--------------------+
```

SQL for query:

```sql
select idwt(s2,"method"="haar") from root.test.d1
```

Output series:

```
+-----------------------------+--------------------------------------+
| Time|idwt(root.test.d1.s2, "method"="haar")|
+-----------------------------+--------------------------------------+
|1970-01-01T08:00:00.000+08:00| 0.0|
|1970-01-01T08:00:00.100+08:00| 0.19999999999999998|
|1970-01-01T08:00:00.200+08:00| 1.4999999999999996|
|1970-01-01T08:00:00.300+08:00| 1.1999999999999997|
|1970-01-01T08:00:00.400+08:00| 0.6|
|1970-01-01T08:00:00.500+08:00| 1.6999999999999997|
|1970-01-01T08:00:00.600+08:00| 0.7999999999999998|
|1970-01-01T08:00:00.700+08:00| 1.9999999999999996|
|1970-01-01T08:00:00.800+08:00| 2.4999999999999996|
|1970-01-01T08:00:00.900+08:00| 2.1|
|1970-01-01T08:00:01.000+08:00| 0.0|
|1970-01-01T08:00:01.100+08:00| 1.9999999999999996|
|1970-01-01T08:00:01.200+08:00| 1.7999999999999998|
|1970-01-01T08:00:01.300+08:00| 1.1999999999999997|
|1970-01-01T08:00:01.400+08:00| 0.9999999999999998|
|1970-01-01T08:00:01.500+08:00| 1.5999999999999999|
+-----------------------------+--------------------------------------+
```


### 5.5 FFT

#### Registration statement

Expand Down Expand Up @@ -3665,7 +3755,7 @@ Note: Based on the conjugation of the Fourier transform result, only the first h
According to the given parameter, data points are reserved from low frequency to high frequency until the reserved energy ratio exceeds it.
The last data point is reserved to indicate the length of the series.

### 5.5 HighPass
### 5.6 HighPass

#### Registration statement

Expand Down Expand Up @@ -3758,7 +3848,7 @@ Output series:

Note: The input is $y=sin(2\pi t/4)+2sin(2\pi t/5)$ with a length of 20. Thus, the output is $y=sin(2\pi t/4)$ after high-pass filtering.

### 5.6 IFFT
### 5.7 IFFT

#### Registration statement

Expand Down Expand Up @@ -3841,7 +3931,7 @@ Output series:
+-----------------------------+-------------------------------------------------------+
```

### 5.7 LowPass
### 5.8 LowPass

#### Registration statement

Expand Down Expand Up @@ -3934,26 +4024,7 @@ Output series:

Note: The input is $y=sin(2\pi t/4)+2sin(2\pi t/5)$ with a length of 20. Thus, the output is $y=2sin(2\pi t/5)$ after low-pass filtering.

<!--

​ 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.

-->

## 6. Data Matching

Expand Down
102 changes: 97 additions & 5 deletions src/UserGuide/Master/Tree/SQL-Manual/UDF-Libraries_timecho.md
Original file line number Diff line number Diff line change
Expand Up @@ -3535,7 +3535,99 @@ Output series:
+-----------------------------+-------------------------------------+
```

### 5.4 FFT

### 5.4 IDWT

#### Registration statement

```sql
create function dwt as 'org.apache.iotdb.library.frequency.UDTFIDWT'
```

#### Usage

This function performs one-dimensional inverse discrete wavelet transform on the input series, reconstructing the original data from DWT decomposed wavelet coefficients.

**Name:** IDWT

**Input:** Only support a single input series. The type is INT32 / INT64 / FLOAT / DOUBLE.

**Parameters:**

+ `method`: The type of wavelet. May select 'Haar', 'DB4', 'DB6', 'DB8', where DB means Daubechies. User may offer coefficients of wavelet transform and ignore this parameter. Case ignored.
+ `coef`: Coefficients of wavelet transform. When providing this parameter, use comma ',' to split them, and leave no spaces or other punctuations.
+ `layer`: Times to transform. The number of output vectors equals $layer+1$. Default is 1.

**Output:** Output a single series. The type is DOUBLE. The length is the same as the input.

**Note:**
* The length of input series must be an integer number power of 2.
* The parameter settings of the IDWT function (method/coef/layer) should be consistent with the corresponding DWT transformation to correctly reconstruct the original data.
* Typically, the input of IDWT is the output result of the DWT function.

#### Examples

##### Haar wavelet transform

Input series:

```
+-----------------------------+--------------------+
| Time| root.test.d1.s2|
+-----------------------------+--------------------+
|1970-01-01T08:00:00.000+08:00| 0.1414213562373095|
|1970-01-01T08:00:00.100+08:00| 1.909188309203678|
|1970-01-01T08:00:00.200+08:00| 1.6263455967290592|
|1970-01-01T08:00:00.300+08:00| 1.979898987322333|
|1970-01-01T08:00:00.400+08:00| 3.2526911934581184|
|1970-01-01T08:00:00.500+08:00| 1.414213562373095|
|1970-01-01T08:00:00.600+08:00| 2.1213203435596424|
|1970-01-01T08:00:00.700+08:00| 1.8384776310850235|
|1970-01-01T08:00:00.800+08:00| -0.1414213562373095|
|1970-01-01T08:00:00.900+08:00| 0.21213203435596428|
|1970-01-01T08:00:01.000+08:00| -0.7778174593052022|
|1970-01-01T08:00:01.100+08:00| -0.8485281374238569|
|1970-01-01T08:00:01.200+08:00| 0.2828427124746189|
|1970-01-01T08:00:01.300+08:00| -1.414213562373095|
|1970-01-01T08:00:01.400+08:00| 0.42426406871192857|
|1970-01-01T08:00:01.500+08:00|-0.42426406871192857|
+-----------------------------+--------------------+
```

SQL for query:

```sql
select idwt(s2,"method"="haar") from root.test.d1
```

Output series:

```
+-----------------------------+--------------------------------------+
| Time|idwt(root.test.d1.s2, "method"="haar")|
+-----------------------------+--------------------------------------+
|1970-01-01T08:00:00.000+08:00| 0.0|
|1970-01-01T08:00:00.100+08:00| 0.19999999999999998|
|1970-01-01T08:00:00.200+08:00| 1.4999999999999996|
|1970-01-01T08:00:00.300+08:00| 1.1999999999999997|
|1970-01-01T08:00:00.400+08:00| 0.6|
|1970-01-01T08:00:00.500+08:00| 1.6999999999999997|
|1970-01-01T08:00:00.600+08:00| 0.7999999999999998|
|1970-01-01T08:00:00.700+08:00| 1.9999999999999996|
|1970-01-01T08:00:00.800+08:00| 2.4999999999999996|
|1970-01-01T08:00:00.900+08:00| 2.1|
|1970-01-01T08:00:01.000+08:00| 0.0|
|1970-01-01T08:00:01.100+08:00| 1.9999999999999996|
|1970-01-01T08:00:01.200+08:00| 1.7999999999999998|
|1970-01-01T08:00:01.300+08:00| 1.1999999999999997|
|1970-01-01T08:00:01.400+08:00| 0.9999999999999998|
|1970-01-01T08:00:01.500+08:00| 1.5999999999999999|
+-----------------------------+--------------------------------------+
```



### 5.5 FFT

#### Registration statement

Expand Down Expand Up @@ -3665,7 +3757,7 @@ Note: Based on the conjugation of the Fourier transform result, only the first h
According to the given parameter, data points are reserved from low frequency to high frequency until the reserved energy ratio exceeds it.
The last data point is reserved to indicate the length of the series.

### 5.5 HighPass
### 5.6 HighPass

#### Registration statement

Expand Down Expand Up @@ -3758,7 +3850,7 @@ Output series:

Note: The input is $y=sin(2\pi t/4)+2sin(2\pi t/5)$ with a length of 20. Thus, the output is $y=sin(2\pi t/4)$ after high-pass filtering.

### 5.6 IFFT
### 5.7 IFFT

#### Registration statement

Expand Down Expand Up @@ -3841,7 +3933,7 @@ Output series:
+-----------------------------+-------------------------------------------------------+
```

### 5.7 LowPass
### 5.8 LowPass

#### Registration statement

Expand Down Expand Up @@ -3935,7 +4027,7 @@ Output series:
Note: The input is $y=sin(2\pi t/4)+2sin(2\pi t/5)$ with a length of 20. Thus, the output is $y=2sin(2\pi t/5)$ after low-pass filtering.


### 5.8 Envelope
### 5.9 Envelope

#### Registration statement

Expand Down
92 changes: 92 additions & 0 deletions src/UserGuide/V1.3.x/SQL-Manual/UDF-Libraries_apache.md
Original file line number Diff line number Diff line change
Expand Up @@ -3538,6 +3538,98 @@ Output series:
+-----------------------------+-------------------------------------+
```



### IDWT

#### Registration statement

```sql
create function dwt as 'org.apache.iotdb.library.frequency.UDTFIDWT'
```

#### Usage

This function performs one-dimensional inverse discrete wavelet transform on the input series, reconstructing the original data from DWT decomposed wavelet coefficients.

**Name:** IDWT

**Input:** Only support a single input series. The type is INT32 / INT64 / FLOAT / DOUBLE.

**Parameters:**

+ `method`: The type of wavelet. May select 'Haar', 'DB4', 'DB6', 'DB8', where DB means Daubechies. User may offer coefficients of wavelet transform and ignore this parameter. Case ignored.
+ `coef`: Coefficients of wavelet transform. When providing this parameter, use comma ',' to split them, and leave no spaces or other punctuations.
+ `layer`: Times to transform. The number of output vectors equals $layer+1$. Default is 1.

**Output:** Output a single series. The type is DOUBLE. The length is the same as the input.

**Note:**
* The length of input series must be an integer number power of 2.
* The parameter settings of the IDWT function (method/coef/layer) should be consistent with the corresponding DWT transformation to correctly reconstruct the original data.
* Typically, the input of IDWT is the output result of the DWT function.

#### Examples

##### Haar wavelet transform

Input series:

```
+-----------------------------+--------------------+
| Time| root.test.d1.s2|
+-----------------------------+--------------------+
|1970-01-01T08:00:00.000+08:00| 0.1414213562373095|
|1970-01-01T08:00:00.100+08:00| 1.909188309203678|
|1970-01-01T08:00:00.200+08:00| 1.6263455967290592|
|1970-01-01T08:00:00.300+08:00| 1.979898987322333|
|1970-01-01T08:00:00.400+08:00| 3.2526911934581184|
|1970-01-01T08:00:00.500+08:00| 1.414213562373095|
|1970-01-01T08:00:00.600+08:00| 2.1213203435596424|
|1970-01-01T08:00:00.700+08:00| 1.8384776310850235|
|1970-01-01T08:00:00.800+08:00| -0.1414213562373095|
|1970-01-01T08:00:00.900+08:00| 0.21213203435596428|
|1970-01-01T08:00:01.000+08:00| -0.7778174593052022|
|1970-01-01T08:00:01.100+08:00| -0.8485281374238569|
|1970-01-01T08:00:01.200+08:00| 0.2828427124746189|
|1970-01-01T08:00:01.300+08:00| -1.414213562373095|
|1970-01-01T08:00:01.400+08:00| 0.42426406871192857|
|1970-01-01T08:00:01.500+08:00|-0.42426406871192857|
+-----------------------------+--------------------+
```

SQL for query:

```sql
select idwt(s2,"method"="haar") from root.test.d1
```

Output series:

```
+-----------------------------+--------------------------------------+
| Time|idwt(root.test.d1.s2, "method"="haar")|
+-----------------------------+--------------------------------------+
|1970-01-01T08:00:00.000+08:00| 0.0|
|1970-01-01T08:00:00.100+08:00| 0.19999999999999998|
|1970-01-01T08:00:00.200+08:00| 1.4999999999999996|
|1970-01-01T08:00:00.300+08:00| 1.1999999999999997|
|1970-01-01T08:00:00.400+08:00| 0.6|
|1970-01-01T08:00:00.500+08:00| 1.6999999999999997|
|1970-01-01T08:00:00.600+08:00| 0.7999999999999998|
|1970-01-01T08:00:00.700+08:00| 1.9999999999999996|
|1970-01-01T08:00:00.800+08:00| 2.4999999999999996|
|1970-01-01T08:00:00.900+08:00| 2.1|
|1970-01-01T08:00:01.000+08:00| 0.0|
|1970-01-01T08:00:01.100+08:00| 1.9999999999999996|
|1970-01-01T08:00:01.200+08:00| 1.7999999999999998|
|1970-01-01T08:00:01.300+08:00| 1.1999999999999997|
|1970-01-01T08:00:01.400+08:00| 0.9999999999999998|
|1970-01-01T08:00:01.500+08:00| 1.5999999999999999|
+-----------------------------+--------------------------------------+
```


### FFT

#### Registration statement
Expand Down
Loading
Loading