Updated on 2024-04-28 GMT+08:00

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
1
2
3
4
5
SELECT (hll_empty() || hll_hash_integer(1)) = (hll_empty() || hll_hash_integer(1));
 ?column?
----------
 t
(1 row)
  • hll_hashval
1
2
3
4
5
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
1
2
3
4
5
SELECT (hll_empty() || hll_hash_integer(1)) <> (hll_empty() || hll_hash_integer(2));
 ?column? 
----------
 t
(1 row)
  • hll_hashval
1
2
3
4
5
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
1
2
3
4
5
SELECT hll_empty() || hll_hash_integer(1);
         ?column?         
--------------------------
 \x128b7f8895a3f5af28cafe
(1 row)
  • hll_add_rev
1
2
3
4
5
SELECT hll_hash_integer(1) || hll_empty();
         ?column?         
--------------------------
 \x128b7f8895a3f5af28cafe
(1 row)
  • hll_union
1
2
3
4
5
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

1
2
3
4
5
SELECT #(hll_empty() || hll_hash_integer(1));
 ?column? 
----------
        1
(1 row)