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
[doc](function) update some array function doc (#1881)
## Versions
- [x] dev
- [ ] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
Copy file name to clipboardexpand all lines: docs/sql-manual/sql-functions/scalar-functions/array-functions/array-count.md
+44-30
Original file line number
Diff line number
Diff line change
@@ -24,66 +24,86 @@ specific language governing permissions and limitations
24
24
under the License.
25
25
-->
26
26
27
-
## array_count
27
+
## Description
28
28
29
-
array_count
29
+
Use lambda expressions as input parameters to perform corresponding expression calculations on the internal data of other input ARRAY parameters.
30
+
Returns the number of elements such that the return value of `lambda(array1[i], ...)` is not 0. Returns 0 if no element is found that satisfies this condition.
31
+
32
+
There are one or more parameters are input in the lambda expression, which must be consistent with the number of input array columns later.The number of elements of all input arrays must be the same. Legal scalar functions can be executed in lambda, aggregate functions, etc. are not supported.
30
33
31
-
### description
34
+
##Syntax
32
35
33
36
```sql
34
-
array_count(lambda, array1, ...)
37
+
ARRAY_COUNT(<arr>),
38
+
ARRAY_COUNT(<lambda>, <arr>[, ... ])
35
39
```
36
40
41
+
## Parameters
37
42
38
-
Use lambda expressions as input parameters to perform corresponding expression calculations on the internal data of other input ARRAY parameters.
39
-
Returns the number of elements such that the return value of `lambda(array1[i], ...)` is not 0. Returns 0 if no element is found that satisfies this condition.
40
-
41
-
There are one or more parameters are input in the lambda expression, which must be consistent with the number of input array columns later.The number of elements of all input arrays must be the same. Legal scalar functions can be executed in lambda, aggregate functions, etc. are not supported.
43
+
| Parameter | Description |
44
+
| --- | --- |
45
+
|`<lambda>`| A lambda expression where the input parameters must match the number of columns in the given array. The expression can execute valid scalar functions but does not support aggregate functions. |
46
+
|`<arr>`| ARRAY array |
42
47
48
+
## Return Value
43
49
44
-
```
45
-
array_count(x->x, array1);
46
-
array_count(x->(x%2 = 0), array1);
47
-
array_count(x->(abs(x)-1), array1);
48
-
array_count((x,y)->(x = y), array1, array2);
49
-
```
50
+
After applying the lambda expression, returns the number of non-zero elements in the ARRAY. If no such elements are found, returns 0.
Copy file name to clipboardexpand all lines: docs/sql-manual/sql-functions/scalar-functions/array-functions/array-exists.md
+45-33
Original file line number
Diff line number
Diff line change
@@ -24,36 +24,38 @@ specific language governing permissions and limitations
24
24
under the License.
25
25
-->
26
26
27
-
## array_exists
27
+
## Description
28
+
29
+
Use an optional lambda expression as an input parameter to perform corresponding expression calculations on the internal data of other input ARRAY parameters. Returns 1 when the calculation returns something other than 0; otherwise returns 0.
30
+
There are one or more parameters input in the lambda expression, which must be consistent with the number of input array columns later. Legal scalar functions can be executed in lambda, aggregate functions, etc. are not supported.
31
+
When lambda expression is not used as a parameter, array1 is used as the calculation result.
Use an optional lambda expression as an input parameter to perform corresponding expression calculations on the internal data of other input ARRAY parameters. Returns 1 when the calculation returns something other than 0; otherwise returns 0.
41
-
There are one or more parameters input in the lambda expression, which must be consistent with the number of input array columns later. Legal scalar functions can be executed in lambda, aggregate functions, etc. are not supported.
42
-
When lambda expression is not used as a parameter, array1 is used as the calculation result.
41
+
## Parameters
43
42
44
-
```
45
-
array_exists(x->x, array1);
46
-
array_exists(x->(x%2 = 0), array1);
47
-
array_exists(x->(abs(x)-1), array1);
48
-
array_exists((x,y)->(x = y), array1, array2);
49
-
array_exists(array1);
50
-
```
43
+
| Parameter | Description |
44
+
| --- | --- |
45
+
|`<lambda>`| A lambda expression where the input parameters must match the number of columns in the given array. The expression can execute valid scalar functions but does not support aggregate functions. |
46
+
|`<arr>`| ARRAY array |
47
+
48
+
## Return Value
51
49
52
-
### example
50
+
Performs the specified expression calculation on the internal data of the input ARRAY parameter. Returns 1 if the calculation result is non-zero; otherwise, returns 0.
51
+
52
+
## Example
53
53
54
54
```sql
55
+
select*, array_exists(x->x>1,[1,2,3]) from array_test2 order by id;
56
+
```
55
57
56
-
mysql [test]>select*, array_exists(x->x>1,[1,2,3]) from array_test2 order by id;
Use the lambda expression as the input parameter to calculate and filter the data of the ARRAY column of the other input parameter.
42
-
And filter out the values of 0 and NULL in the result.
39
+
## Parameters
43
40
44
-
```
45
-
array_filter(x->x>0, array1);
46
-
array_filter(x->(x+2)=10, array1);
47
-
array_filter(x->(abs(x)-2)>0, array1);
48
-
array_filter(c_array,[0,1,0]);
49
-
```
41
+
| Parameter | Description |
42
+
| --- | --- |
43
+
|`<lambda>`| A lambda expression where the input parameters must match the number of columns in the given array. The expression can execute valid scalar functions but does not support aggregate functions. |
44
+
|`<arr>`| ARRAY array |
45
+
46
+
## Return Value
50
47
51
-
### example
48
+
Performs the specified expression calculation on the internal data of the input ARRAY parameter, filtering out 0 and NULL values from the result.
52
49
53
-
```shell
54
-
mysql [test]>select c_array,array_filter(c_array,[0,1,0]) from array_test;
50
+
## Example
51
+
52
+
```sql
53
+
select c_array,array_filter(c_array,[0,1,0]) from array_test;
0 commit comments