云数据库 GAUSSDB-HLL函数和操作符:功能函数
功能函数
- hll_empty()
返回值类型:hll
示例:
1 2 3 4 5
openGauss=# SELECT hll_empty(); hll_empty ------------------------------------------------------------ \x484c4c00000000002b05000000000000000000000000000000000000 (1 row)
- hll_empty(int32 log2m)
描述:创建空的hll并指定参数log2m,取值范围是10到16。若输入-1,则采用内置默认值。
返回值类型:hll
示例:
1 2 3 4 5 6 7 8 9 10 11
openGauss=# SELECT hll_empty(10); hll_empty ------------------------------------------------------------ \x484c4c00000000002b04000000000000000000000000000000000000 (1 row) openGauss=# SELECT hll_empty(-1); hll_empty ------------------------------------------------------------ \x484c4c00000000002b05000000000000000000000000000000000000 (1 row)
- hll_empty(int32 log2m, int32 log2explicit)
描述:创建空的hll并依次指定参数log2m、log2explicit。log2explicit取值范围是0到12,0表示直接跳过Explicit模式。该参数可以用来设置Explicit模式的阈值大小,在数据段长度达到2log2explicit后切换为Sparse模式或者Full模式。若输入-1,则log2explicit采用内置默认值。
返回值类型: hll
示例:
1 2 3 4 5 6 7 8 9 10 11
openGauss=# SELECT hll_empty(10, 4); hll_empty ------------------------------------------------------------ \x484c4c00000000001304000000000000000000000000000000000000 (1 row) openGauss=# SELECT hll_empty(10, -1); hll_empty ------------------------------------------------------------ \x484c4c00000000002b04000000000000000000000000000000000000 (1 row)
- hll_empty(int32 log2m, int32 log2explicit, int64 log2sparse)
描述:创建空的hll并依次指定参数log2m、log2explicit、log2sparse。log2sparse取值范围是0到14,0表示直接跳过Sparse模式。该参数可以用来设置Sparse模式的阈值大小,在数据段长度达到2log2sparse后切换为Full模式。若输入-1,则log2sparse采用内置默认值。
返回值类型:hll
示例:
1 2 3 4 5 6 7 8 9 10 11
openGauss=# SELECT hll_empty(10, 4, 8); hll_empty ------------------------------------------------------------ \x484c4c00000000001204000000000000000000000000000000000000 (1 row) openGauss=# SELECT hll_empty(10, 4, -1); hll_empty ------------------------------------------------------------ \x484c4c00000000001304000000000000000000000000000000000000 (1 row)
- hll_empty(int32 log2m, int32 log2explicit, int64 log2sparse, int32 duplicatecheck)
描述:创建空的hll并依次指定参数log2m、log2explicit、log2sparse、duplicatecheck。duplicatecheck取0或者1,表示是否开启该模式,默认情况下该模式会关闭。若输入-1,则duplicatecheck采用内置默认值。
返回值类型:hll
示例:
1 2 3 4 5 6 7 8 9 10 11
openGauss=# SELECT hll_empty(10, 4, 8, 0); hll_empty ------------------------------------------------------------ \x484c4c00000000001204000000000000000000000000000000000000 (1 row) openGauss=# SELECT hll_empty(10, 4, 8, -1); hll_empty ------------------------------------------------------------ \x484c4c00000000001204000000000000000000000000000000000000 (1 row)
- hll_add(hll, hll_hashval)
返回值类型:hll
示例:
1 2 3 4 5
openGauss=# SELECT hll_add(hll_empty(), hll_hash_integer(1)); hll_add ---------------------------------------------------------------------------- \x484c4c08000002002b0900000000000000f03f3e2921ff133fbaed3e2921ff133fbaed00 (1 row)
- hll_add_rev(hll_hashval, hll)
描述:把hll_hashval加入到hll中,和hll_add功能一样,只是参数位置进行了交换。
返回值类型:hll
示例:
1 2 3 4 5
openGauss=# SELECT hll_add_rev(hll_hash_integer(1), hll_empty()); hll_add_rev ---------------------------------------------------------------------------- \x484c4c08000002002b0900000000000000f03f3e2921ff133fbaed3e2921ff133fbaed00 (1 row)
- hll_eq(hll, hll)
返回值类型:bool
示例:
1 2 3 4 5
openGauss=# 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)
返回值类型:bool
示例:
1 2 3 4 5
openGauss=# 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)
返回值类型:int
示例:
1 2 3 4 5
openGauss=# SELECT hll_cardinality(hll_empty() || hll_hash_integer(1)); hll_cardinality ----------------- 1 (1 row)
- hll_union(hll, hll)
返回值类型:hll
示例:
1 2 3 4 5
openGauss=# SELECT hll_union(hll_add(hll_empty(), hll_hash_integer(1)), hll_add(hll_empty(), hll_hash_integer(2))); hll_union -------------------------------------------------------------------------------------------- \x484c4c10002000002b090000000000000000400000000000000000b3ccc49320cca1ae3e2921ff133fbaed00 (1 row)
- GaussDB数据库函数_GaussDB函数和操作符_高斯数据库函数-华为云
- GaussDB数据库函数和字符串_高斯数据库优势_新建高斯数据库_高斯协议
- GaussDB函数_GaussDB数据库函数_高斯数据库函数_华为云
- GaussDB支持的函数_GaussDB函数类型解析_高斯数据库支持的函数-华为云
- 调用函数_函数调用方式_函数工作流 FunctionGraph-华为云
- GaussDB数据库函数_GaussDB介绍_高斯数据库函数
- 什么是函数工作流_函数托管计算服务_函数工作流 FunctionGraph-华为云
- 使用容器镜像部署函数_函数部署_函数工作流 FunctionGraph-华为云
- 如何使用模板创建函数_模板创建函数_函数工作流 FunctionGraph-华为云
- 使用SpringBoot构建HTTP函数_functiongraph_函数工作流