bitmap_and_not,bitmap_andnot

description

Syntax

BITMAP BITMAP_AND_NOT(BITMAP lhs, BITMAP rhs)

将两个bitmap进行与非操作并返回计算结果。

example

  1. mysql> select bitmap_count(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'))) cnt;
  2. +------+
  3. | cnt |
  4. +------+
  5. | 2 |
  6. +------+
  7. mysql> select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')));
  8. +--------------------------------------------------------------------------------------------+
  9. | bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'))) |
  10. +--------------------------------------------------------------------------------------------+
  11. | 1,2 |
  12. +--------------------------------------------------------------------------------------------+
  13. 1 row in set (0.01 sec)
  14. mysql> select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty())) ;
  15. +-------------------------------------------------------------------------------+
  16. | bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), bitmap_empty())) |
  17. +-------------------------------------------------------------------------------+
  18. | 1,2,3 |
  19. +-------------------------------------------------------------------------------+
  20. mysql> select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL));
  21. +---------------------------------------------------------------------+
  22. | bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), NULL)) |
  23. +---------------------------------------------------------------------+
  24. | NULL |
  25. +---------------------------------------------------------------------+

keywords

  1. BITMAP_AND_NOT,BITMAP_ANDNOT,BITMAP