Skip to content

Commit 1b8776d

Browse files
committed
adjust countif number
1 parent fba98c6 commit 1b8776d

4 files changed

Lines changed: 122 additions & 111 deletions

File tree

src/UserGuide/Master/Table/SQL-Manual/Basis-Function.md

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ SELECT LEAST(temperature,humidity) FROM table2;
157157
### 2.2 Supported Aggregate Functions
158158

159159
| Function Name | Description | Allowed Input Types | Output Type |
160-
|:--------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------| :----------------------------------------- |
160+
|:--------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------|:-------------------------------------------|
161161
| COUNT | Counts the number of data points. | All types | INT64 |
162+
| COUNT_IF | COUNT_IF(exp) counts the number of rows that satisfy a specified boolean expression. | `exp` must be a boolean expression,(e.g. `count_if(temperature>20)`) | INT64 |
162163
| SUM | Calculates the sum. | INT32 INT64 FLOAT DOUBLE | DOUBLE |
163164
| AVG | Calculates the average. | INT32 INT64 FLOAT DOUBLE | DOUBLE |
164165
| MAX | Finds the maximum value. | All types | Same as input type |
@@ -177,7 +178,7 @@ SELECT LEAST(temperature,humidity) FROM table2;
177178
| MIN_BY | MIN_BY(x, y) finds the value of x corresponding to the minimum y in the binary input x and y. MIN_BY(time, x) returns the timestamp when x is at its minimum. | x and y can be of any type | Same as the data type of the first input x |
178179
| FIRST_BY | FIRST_BY(x, y) finds the value of x in the same row when y is the first non-null value. | x and y can be of any type | Same as the data type of the first input x |
179180
| LAST_BY | LAST_BY(x, y) finds the value of x in the same row when y is the last non-null value. | x and y can be of any type | Same as the data type of the first input x |
180-
| COUNT_IF | COUNT_IF(exp) counts the number of rows that satisfy a specified boolean expression. | `exp` must be a boolean expression,(e.g. `count_if(temperature>20)`) | INT64 |
181+
181182

182183
### 2.3 Examples
183184

@@ -207,7 +208,29 @@ Total line number = 1
207208
It costs 0.834s
208209
```
209210

210-
#### 2.3.3 First
211+
212+
#### 2.3.3 Count_if
213+
214+
Count `Non-Null` `arrival_time` Records in `table2`
215+
216+
```sql
217+
select count_if(arrival_time is not null) from table2;
218+
```
219+
220+
The execution result is as follows:
221+
222+
```sql
223+
+-----+
224+
|_col0|
225+
+-----+
226+
| 4|
227+
+-----+
228+
Total line number = 1
229+
It costs 0.047s
230+
```
231+
232+
233+
#### 2.3.4 First
211234

212235
Finds the values with the smallest timestamp that are not NULL in the `temperature` and `humidity` columns.
213236

@@ -227,7 +250,7 @@ Total line number = 1
227250
It costs 0.170s
228251
```
229252

230-
#### 2.3.4 Last
253+
#### 2.3.5 Last
231254

232255
Finds the values with the largest timestamp that are not NULL in the `temperature` and `humidity` columns.
233256

@@ -247,7 +270,7 @@ Total line number = 1
247270
It costs 0.211s
248271
```
249272

250-
#### 2.3.5 First_by
273+
#### 2.3.6 First_by
251274

252275
Finds the `time` value of the row with the smallest timestamp that is not NULL in the `temperature` column, and the `humidity` value of the row with the smallest timestamp that is not NULL in the `temperature` column.
253276

@@ -267,7 +290,7 @@ Total line number = 1
267290
It costs 0.269s
268291
```
269292

270-
#### 2.3.6 Last_by
293+
#### 2.3.7 Last_by
271294

272295
Queries the `time` value of the row with the largest timestamp that is not NULL in the `temperature` column, and the `humidity` value of the row with the largest timestamp that is not NULL in the `temperature` column.
273296

@@ -287,7 +310,7 @@ Total line number = 1
287310
It costs 0.070s
288311
```
289312

290-
#### 2.3.7 Max_by
313+
#### 2.3.8 Max_by
291314

292315
Queries the `time` value of the row where the `temperature` column is at its maximum, and the `humidity` value of the row where the `temperature` column is at its maximum.
293316

@@ -307,7 +330,7 @@ Total line number = 1
307330
It costs 0.172s
308331
```
309332

310-
#### 2.3.8 Min_by
333+
#### 2.3.9 Min_by
311334

312335
Queries the `time` value of the row where the `temperature` column is at its minimum, and the `humidity` value of the row where the `temperature` column is at its minimum.
313336

@@ -328,27 +351,6 @@ It costs 0.244s
328351
```
329352

330353

331-
### 2.3.9 Count_if
332-
333-
Count `Non-Null` `arrival_time` Records in `table2`
334-
335-
```sql
336-
select count_if(arrival_time is not null) from table2;
337-
```
338-
339-
The execution result is as follows:
340-
341-
```sql
342-
+-----+
343-
|_col0|
344-
+-----+
345-
| 4|
346-
+-----+
347-
Total line number = 1
348-
It costs 0.047s
349-
```
350-
351-
352354
## 3. Logical operators
353355

354356
### 3.1 Overview

src/UserGuide/latest-Table/SQL-Manual/Basis-Function.md

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ SELECT LEAST(temperature,humidity) FROM table2;
157157
### 2.2 Supported Aggregate Functions
158158

159159
| Function Name | Description | Allowed Input Types | Output Type |
160-
|:--------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------| :----------------------------------------- |
160+
|:--------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------|:-------------------------------------------|
161161
| COUNT | Counts the number of data points. | All types | INT64 |
162+
| COUNT_IF | COUNT_IF(exp) counts the number of rows that satisfy a specified boolean expression. | `exp` must be a boolean expression,(e.g. `count_if(temperature>20)`) | INT64 |
162163
| SUM | Calculates the sum. | INT32 INT64 FLOAT DOUBLE | DOUBLE |
163164
| AVG | Calculates the average. | INT32 INT64 FLOAT DOUBLE | DOUBLE |
164165
| MAX | Finds the maximum value. | All types | Same as input type |
@@ -177,7 +178,7 @@ SELECT LEAST(temperature,humidity) FROM table2;
177178
| MIN_BY | MIN_BY(x, y) finds the value of x corresponding to the minimum y in the binary input x and y. MIN_BY(time, x) returns the timestamp when x is at its minimum. | x and y can be of any type | Same as the data type of the first input x |
178179
| FIRST_BY | FIRST_BY(x, y) finds the value of x in the same row when y is the first non-null value. | x and y can be of any type | Same as the data type of the first input x |
179180
| LAST_BY | LAST_BY(x, y) finds the value of x in the same row when y is the last non-null value. | x and y can be of any type | Same as the data type of the first input x |
180-
| COUNT_IF | COUNT_IF(exp) counts the number of rows that satisfy a specified boolean expression. | `exp` must be a boolean expression,(e.g. `count_if(temperature>20)`) | INT64 |
181+
181182

182183
### 2.3 Examples
183184

@@ -207,7 +208,29 @@ Total line number = 1
207208
It costs 0.834s
208209
```
209210

210-
#### 2.3.3 First
211+
212+
#### 2.3.3 Count_if
213+
214+
Count `Non-Null` `arrival_time` Records in `table2`
215+
216+
```sql
217+
select count_if(arrival_time is not null) from table2;
218+
```
219+
220+
The execution result is as follows:
221+
222+
```sql
223+
+-----+
224+
|_col0|
225+
+-----+
226+
| 4|
227+
+-----+
228+
Total line number = 1
229+
It costs 0.047s
230+
```
231+
232+
233+
#### 2.3.4 First
211234

212235
Finds the values with the smallest timestamp that are not NULL in the `temperature` and `humidity` columns.
213236

@@ -227,7 +250,7 @@ Total line number = 1
227250
It costs 0.170s
228251
```
229252

230-
#### 2.3.4 Last
253+
#### 2.3.5 Last
231254

232255
Finds the values with the largest timestamp that are not NULL in the `temperature` and `humidity` columns.
233256

@@ -247,7 +270,7 @@ Total line number = 1
247270
It costs 0.211s
248271
```
249272

250-
#### 2.3.5 First_by
273+
#### 2.3.6 First_by
251274

252275
Finds the `time` value of the row with the smallest timestamp that is not NULL in the `temperature` column, and the `humidity` value of the row with the smallest timestamp that is not NULL in the `temperature` column.
253276

@@ -267,7 +290,7 @@ Total line number = 1
267290
It costs 0.269s
268291
```
269292

270-
#### 2.3.6 Last_by
293+
#### 2.3.7 Last_by
271294

272295
Queries the `time` value of the row with the largest timestamp that is not NULL in the `temperature` column, and the `humidity` value of the row with the largest timestamp that is not NULL in the `temperature` column.
273296

@@ -287,7 +310,7 @@ Total line number = 1
287310
It costs 0.070s
288311
```
289312

290-
#### 2.3.7 Max_by
313+
#### 2.3.8 Max_by
291314

292315
Queries the `time` value of the row where the `temperature` column is at its maximum, and the `humidity` value of the row where the `temperature` column is at its maximum.
293316

@@ -307,7 +330,7 @@ Total line number = 1
307330
It costs 0.172s
308331
```
309332

310-
#### 2.3.8 Min_by
333+
#### 2.3.9 Min_by
311334

312335
Queries the `time` value of the row where the `temperature` column is at its minimum, and the `humidity` value of the row where the `temperature` column is at its minimum.
313336

@@ -328,27 +351,6 @@ It costs 0.244s
328351
```
329352

330353

331-
### 2.3.9 Count_if
332-
333-
Count `Non-Null` `arrival_time` Records in `table2`
334-
335-
```sql
336-
select count_if(arrival_time is not null) from table2;
337-
```
338-
339-
The execution result is as follows:
340-
341-
```sql
342-
+-----+
343-
|_col0|
344-
+-----+
345-
| 4|
346-
+-----+
347-
Total line number = 1
348-
It costs 0.047s
349-
```
350-
351-
352354
## 3. Logical operators
353355

354356
### 3.1 Overview

0 commit comments

Comments
 (0)