bitmap_or

description

Syntax

BITMAP BITMAP_OR(BITMAP lhs, BITMAP rhs, ...)

Compute union of two or more input bitmaps, returns the new bitmap.

example

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

keyword

  1. BITMAP_OR,BITMAP