bitmap_and_count

description

Syntax

BigIntVal bitmap_and_count(BITMAP lhs, BITMAP rhs, ...)

Calculate the intersection of two or more input bitmaps and return the number of intersections.

example

  1. MySQL> select bitmap_and_count(bitmap_from_string('1,2,3'),bitmap_empty());
  2. +---------------------------------------------------------------+
  3. | bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_empty()) |
  4. +---------------------------------------------------------------+
  5. | 0 |
  6. +---------------------------------------------------------------+
  7. MySQL> select bitmap_and_count(bitmap_from_string('1,2,3'),bitmap_from_string('1,2,3'));
  8. +----------------------------------------------------------------------------+
  9. | bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2,3')) |
  10. +----------------------------------------------------------------------------+
  11. | 3 |
  12. +----------------------------------------------------------------------------+
  13. MySQL> select bitmap_and_count(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'));
  14. +----------------------------------------------------------------------------+
  15. | bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5')) |
  16. +----------------------------------------------------------------------------+
  17. | 1 |
  18. +----------------------------------------------------------------------------+
  19. MySQL> select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'));
  20. +-------------------------------------------------------------------------------------------------------------+
  21. | (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'))) |
  22. +-------------------------------------------------------------------------------------------------------------+
  23. | 2 |
  24. +-------------------------------------------------------------------------------------------------------------+
  25. MySQL> select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'),bitmap_empty());
  26. +-----------------------------------------------------------------------------------------------------------------------------+
  27. | (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), bitmap_empty())) |
  28. +-----------------------------------------------------------------------------------------------------------------------------+
  29. | 0 |
  30. +-----------------------------------------------------------------------------------------------------------------------------+
  31. MySQL> select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), NULL);
  32. +-------------------------------------------------------------------------------------------------------------------+
  33. | (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), NULL)) |
  34. +-------------------------------------------------------------------------------------------------------------------+
  35. | NULL |
  36. +-------------------------------------------------------------------------------------------------------------------+

keyword

  1. BITMAP_AND_COUNT,BITMAP