bitmap_from_array

description

Syntax

BITMAP BITMAP_FROM_ARRAY(ARRAY input)

将一个TINYINT/SMALLINT/INT/BIGINT类型的数组转化为一个BITMAP 当输入字段不合法时,结果返回NULL

example

  1. mysql> select *, bitmap_to_string(bitmap_from_array(c_array)) from array_test;
  2. +------+-----------------------+------------------------------------------------+
  3. | id | c_array | bitmap_to_string(bitmap_from_array(`c_array`)) |
  4. +------+-----------------------+------------------------------------------------+
  5. | 1 | [NULL] | NULL |
  6. | 2 | [1, 2, 3, NULL] | NULL |
  7. | 2 | [1, 2, 3, -10] | NULL |
  8. | 3 | [1, 2, 3, 4, 5, 6, 7] | 1,2,3,4,5,6,7 |
  9. | 4 | [100, 200, 300, 300] | 100,200,300 |
  10. +------+-----------------------+------------------------------------------------+
  11. 5 rows in set (0.02 sec)

keywords

  1. BITMAP_FROM_ARRAY,BITMAP