HLL Operators

The HLL type supports the following operators:

Table 1 HLL Operators

HLL Operators

Description

Return Type

Example

=

Checks whether the values of hll and hll_hashval are equal.

bool

  • hll

SELECT (hll_empty() || hll_hash_integer(1)) = (hll_empty() || hll_hash_integer(1));
 ?column?
----------
 t
(1 row)
  • hll_hashval

SELECT hll_hash_integer(1) = hll_hash_integer(1);
 ?column?
----------
 t
(1 row)

<> or !=

Checks whetherthe values of hll and hll_hashval are not equal.

bool

  • hll

SELECT (hll_empty() || hll_hash_integer(1)) <> (hll_empty() || hll_hash_integer(2));
 ?column?
----------
 t
(1 row)
  • hll_hashval

SELECT hll_hash_integer(1) <> hll_hash_integer(2);
 ?column?
----------
 t
(1 row)

||

Represents the functions of hll_add, hll_union, hll_add_rev.

hll

  • hll_add

SELECT hll_empty() || hll_hash_integer(1);
         ?column?
--------------------------
 \x128b7f8895a3f5af28cafe
(1 row)
  • hll_add_rev

SELECT hll_hash_integer(1) || hll_empty();
         ?column?
--------------------------
 \x128b7f8895a3f5af28cafe
(1 row)
  • hll_union

SELECT (hll_empty() || hll_hash_integer(1)) || (hll_empty() || hll_hash_integer(2));
                 ?column?
------------------------------------------
 \x128b7f8895a3f5af28cafeda0ce907e4355b60
(1 row)

#

Calculates the distinct value of the hll. It is the same as that of the hll_cardinality function.

integer

SELECT #(hll_empty() || hll_hash_integer(1));
 ?column?
----------
        1
(1 row)