暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

HashFunc函数——hash_group(key)

MTL 2022-10-15
374
  • hash_group(key)

    描述:流引擎中,该函数可将Group Clause中的各列计算为一个hash值。

    参数:key为Group Clause中各列的值。

    返回值类型:32位hash值

    示例:

    按照步骤依次执行。
    openGauss=# CREATE TABLE tt(a int, b int,c int,d int);
    NOTICE:  The 'DISTRIBUTE BY' clause is not specified. Using 'a' as the distribution column by default.
    HINT:  Please use 'DISTRIBUTE BY' clause to specify suitable data distribution column.
    CREATE TABLE
    openGauss=# select * from tt;
     a | b | c | d 
    ---+---+---+---
    (0 rows)
        
    openGauss=# insert into tt values(1,2,3,4);
    INSERT 0 1
    openGauss=# select * from tt;
     a | b | c | d 
    ---+---+---+---
     1 | 2 | 3 | 4
    (1 row)
        
    openGauss=# insert into tt values(5,6,7,8);
    INSERT 0 1
    openGauss=# select * from tt;
     a | b | c | d 
    ---+---+---+---
     1 | 2 | 3 | 4
     5 | 6 | 7 | 8
    (2 rows)
        
    openGauss=# select hash_group(a,b) from tt where a=1 and b=2;
     hash_group 
    ------------
      990882385
    (1 row)
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论