You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 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|
543
549
| MAX_VALUE | Find the maximum value. | INT32 INT64 FLOAT DOUBLE | / | Consistent with the input data type|
544
550
| 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:
549
555
| 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`:The specified threshold or threshold condition, it is equivalent to `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 |
550
556
| 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 |
551
557
| 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|
552
-
| STDDEV | Calculate the overall standard deviation of the data. Note:<br> Missing points, null points and `NaN`in the input series will be ignored.| INT32 INT64 FLOAT DOUBLE | / | DOUBLE |
553
558
| 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 |
559
+
| 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. <br> 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. |
560
+
| 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. <br> 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. |
554
561
555
562
556
-
### COUNT
557
-
558
-
#### example
559
-
560
-
```sql
561
-
selectcount(status) from root.ln.wf01.wt01;
562
-
```
563
-
Result:
564
-
565
-
```
566
-
+-------------------------------+
567
-
|count(root.ln.wf01.wt01.status)|
568
-
+-------------------------------+
569
-
| 10080|
570
-
+-------------------------------+
571
-
Total line number = 1
572
-
It costs 0.016s
573
-
```
574
-
575
563
### COUNT_IF
576
564
577
565
#### Grammar
@@ -800,6 +788,206 @@ Result
800
788
> 3. Count_time aggregation used with having statement is not supported, and count_time aggregation can not appear in the having statement.
801
789
> 4. Count_time does not support use with group by level, group by tag.
802
790
791
+
792
+
793
+
794
+
### MAX_BY
795
+
796
+
#### Function Definition
797
+
`max_by(x, y)`: Returns the value of x at the timestamp where y reaches its maximum.
798
+
799
+
- `max_by` must have two input parameters x and y.
800
+
- The first input can be the time keyword. `max_by(time, x)` returns the timestamp when x reaches its maximum value.
801
+
- Returns null if x is null at the timestamp where y is maximum.
802
+
- If y achieves its maximum at multiple timestamps, returns the x value at the smallest timestamp among them.
803
+
- Aligns with IoTDB's `max_value`: Only supports INT32, INT64, FLOAT, DOUBLE as y input. Supports all six data types as x input.
0 commit comments