Updated on 2025-05-29 GMT+08:00

Operators

=

Description: Compares the values of the HLL or hll_hashval type to check whether they are the same.

Return type: Boolean

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
--hll
gaussdb=# SELECT (hll_empty() || hll_hash_integer(1)) = (hll_empty() || hll_hash_integer(1));
column 
----------
 t
(1 row)

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

<> or !=

Description: Compares the values of the HLL or hll_hashval type to check whether they are different.

Return type: Boolean

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
--hll
gaussdb=# SELECT (hll_empty() || hll_hash_integer(1)) <> (hll_empty() || hll_hash_integer(2));
 ?column? 
----------
 t
(1 row)

--hll_hashval
gaussdb=# SELECT hll_hash_integer(1) <> hll_hash_integer(2);
 ?column? 
----------
 t
(1 row)

||

Description: Represents the hll_add, hll_union, and hll_add_rev functions.

Return type: HLL

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
--hll_add
gaussdb=# SELECT hll_empty() || hll_hash_integer(1);
                                  ?column?
----------------------------------------------------------------------------
 \x484c4c08000002002b0900000000000000f03f3e2921ff133fbaed3e2921ff133fbaed00
(1 row)

--hll_add_rev
gaussdb=# SELECT hll_hash_integer(1) || hll_empty();
                                  ?column?
----------------------------------------------------------------------------
 \x484c4c08000002002b0900000000000000f03f3e2921ff133fbaed3e2921ff133fbaed00
(1 row)

--hll_union
gaussdb=# SELECT (hll_empty() || hll_hash_integer(1)) || (hll_empty() || hll_hash_integer(2));
                                          ?column?
--------------------------------------------------------------------------------------------
 \x484c4c10002000002b090000000000000000400000000000000000b3ccc49320cca1ae3e2921ff133fbaed00
(1 row)

#

Description: Calculates the number of distinct values of an HLL. It works the same as the hll_cardinality function.

Return type: int

Example:

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