countequal
Description
Syntax:
BIGINT countequal(ARRAY<T> arr, T value)
This function returns the number of values in the array. It returns one of the following results:
num - the number of values in the array;
0 - there are no values in the array;
NULL - the array is NULL or the value is NULL.
Note:
It is only supported in vectorized engine.
Example
mysql> set enable_vectorized_engine=true;
mysql> select *, countEqual(c_array,5) from array_test;
+------+-----------------+--------------------------+
| id | c_array | countequal(`c_array`, 5) |
+------+-----------------+--------------------------+
| 1 | [1, 2, 3, 4, 5] | 1 |
| 2 | [6, 7, 8] | 0 |
| 3 | [] | 0 |
| 4 | NULL | NULL |
+------+-----------------+--------------------------+
Keywords
ARRAY,COUNTEQUAL