Functional Functions
hll_empty()
Description: Creates an empty HLL.
Return type: HLL
Example:
1 2 3 4 5 |
gaussdb=# SELECT hll_empty(); hll_empty ------------------------------------------------------------ \x484c4c00000000002b05000000000000000000000000000000000000 (1 row) |
hll_empty(int32 log2m)
Description: Creates an empty HLL and sets the log2m parameter. The parameter value ranges from 10 to 16. If the input is –1, the built-in default value is used.
Return type: HLL
Example:
1 2 3 4 5 6 7 8 9 10 11 |
gaussdb=# SELECT hll_empty(10); hll_empty ------------------------------------------------------------ \x484c4c00000000002b04000000000000000000000000000000000000 (1 row) gaussdb=# SELECT hll_empty(-1); hll_empty ------------------------------------------------------------ \x484c4c00000000002b05000000000000000000000000000000000000 (1 row) |
hll_empty(int32 log2m, int32 log2explicit)
Description: Creates an empty HLL and sets the log2m and log2explicit parameters in sequence. The value of log2explicit ranges from 0 to 12. The value 0 indicates that the explicit mode is skipped. This parameter is used to set the threshold of the explicit mode. When the length of the data segment reaches 2log2explicit, the mode is switched to the sparse or full mode. If the input is –1, the built-in default value of log2explicit is used.
Return type: HLL
Example:
1 2 3 4 5 6 7 8 9 10 11 |
gaussdb=# SELECT hll_empty(10, 4); hll_empty ------------------------------------------------------------ \x484c4c00000000001304000000000000000000000000000000000000 (1 row) gaussdb=# SELECT hll_empty(10, -1); hll_empty ------------------------------------------------------------ \x484c4c00000000002b04000000000000000000000000000000000000 (1 row) |
hll_empty(int32 log2m, int32 log2explicit, int64 log2sparse)
Description: Creates an empty HLL and sets the log2m, log2explicit and log2sparse parameters in sequence. The value of log2sparse ranges from 0 to 14. The value 0 indicates that the sparse mode is skipped. This parameter is used to set the threshold of the sparse mode. When the length of the data segment reaches 2log2sparse, the mode is switched to the full mode. If the input is –1, the built-in default value of log2sparse is used.
Return type: HLL
Example:
1 2 3 4 5 6 7 8 9 10 11 |
gaussdb=# SELECT hll_empty(10, 4, 8); hll_empty ------------------------------------------------------------ \x484c4c00000000001204000000000000000000000000000000000000 (1 row) gaussdb=# SELECT hll_empty(10, 4, -1); hll_empty ------------------------------------------------------------ \x484c4c00000000001304000000000000000000000000000000000000 (1 row) |
hll_empty(int32 log2m, int32 log2explicit, int64 log2sparse, int32 duplicatecheck)
Description: Creates an empty HLL and sets the log2m, log2explicit, log2sparse, and duplicatecheck parameters in sequence. The value of duplicatecheck is 0 or 1, indicating whether the duplicate check mode is enabled. By default, this mode is disabled. If the input is –1, the built-in default value of duplicatecheck is used.
Return type: HLL
Example:
1 2 3 4 5 6 7 8 9 10 11 |
gaussdb=# SELECT hll_empty(10, 4, 8, 0); hll_empty ------------------------------------------------------------ \x484c4c00000000001204000000000000000000000000000000000000 (1 row) gaussdb=# SELECT hll_empty(10, 4, 8, -1); hll_empty ------------------------------------------------------------ \x484c4c00000000001204000000000000000000000000000000000000 (1 row) |
hll_add(hll, hll_hashval)
Description: Adds hll_hashval to an HLL.
Return type: HLL
Example:
1 2 3 4 5 |
gaussdb=# SELECT hll_add(hll_empty(), hll_hash_integer(1)); hll_add ---------------------------------------------------------------------------- \x484c4c08000002002b0900000000000000f03f3e2921ff133fbaed3e2921ff133fbaed00 (1 row) |
hll_add_rev(hll_hashval, hll)
Description: Adds hll_hashval to an HLL. This function works the same as hll_add, except that the positions of parameters are switched.
Return type: HLL
Example:
1 2 3 4 5 |
gaussdb=# SELECT hll_add_rev(hll_hash_integer(1), hll_empty()); hll_add_rev ---------------------------------------------------------------------------- \x484c4c08000002002b0900000000000000f03f3e2921ff133fbaed3e2921ff133fbaed00 (1 row) |
hll_eq(hll, hll)
Description: Compares two HLLs to check whether they are the same.
Return type: Boolean
Example:
1 2 3 4 5 |
gaussdb=# SELECT hll_eq(hll_add(hll_empty(), hll_hash_integer(1)), hll_add(hll_empty(), hll_hash_integer(2))); hll_eq -------- f (1 row) |
hll_ne(hll, hll)
Description: Compares two HLLs to check whether they are different.
Return type: Boolean
Example:
1 2 3 4 5 |
gaussdb=# SELECT hll_ne(hll_add(hll_empty(), hll_hash_integer(1)), hll_add(hll_empty(), hll_hash_integer(2))); hll_ne -------- t (1 row) |
hll_cardinality(hll)
Description: Calculates the number of distinct values of an HLL.
Return type: int
Example:
1 2 3 4 5 |
gaussdb=# SELECT hll_cardinality(hll_empty() || hll_hash_integer(1)); hll_cardinality ----------------- 1 (1 row) |
hll_union(hll, hll)
Description: Performs the UNION operation on two HLL data structures to obtain one HLL.
Return type: HLL
Example:
1 2 3 4 5 |
gaussdb=# SELECT hll_union(hll_add(hll_empty(), hll_hash_integer(1)), hll_add(hll_empty(), hll_hash_integer(2))); hll_union -------------------------------------------------------------------------------------------- \x484c4c10002000002b090000000000000000400000000000000000b3ccc49320cca1ae3e2921ff133fbaed00 (1 row) |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot