
# HashFunc函数
- hash_array(anyarray) 描述：数组哈希，将数组的元素通过哈希函数得到结果，并返回合并结果。
  参数：数据类型为anyarray。
  返回值类型：integer
  示例：
  ```
  openGauss=# SELECT hash_array(ARRAY[[1,2,3],[1,2,3]]);
   hash_array 
  ------------
   -382888479
  (1 row)
  ```
  
- 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)
  openGauss=# DROP TABLE tt;
  DROP TABLE
  ```
  
- hash_numeric(numeric) 描述：计算Numeric类型的数据的hash值。
  参数：Numeric类型的数据。
  返回值类型：integer
  示例：
  ```
  openGauss=# SELECT hash_numeric(30);
   hash_numeric 
  --------------
     -282860963
  (1 row)
  ```
  
- hash_range(anyrange) 描述：计算range的哈希值。
  参数：anyrange类型的数据。
  返回值类型：integer
  示例：
  ```
  openGauss=# SELECT hash_range(numrange(1.1,2.2));
   hash_range 
  ------------
    683508754
  (1 row)
  ```
  
- hashbpchar(character) 描述：计算bpchar的哈希值。
  参数：character类型的数据。
  返回值类型：integer
  示例：
  ```
  openGauss=# SELECT hashbpchar('hello');
   hashbpchar  
  -------------
   -1870292951
  (1 row)
  ```
  
- hashchar(char) 描述：char和布尔数据转换为哈希值。
  参数：char类型的数据或者bool类型的数据。
  返回值类型：integer
  示例：
  ```
  openGauss=# SELECT hashbpchar('hello');
   hashbpchar  
  -------------
   -1870292951
  (1 row)
  openGauss=# SELECT hashchar('true');
    hashchar  
  ------------
   1686226652
  (1 row)
  ```
  
- hashenum(anyenum) 描述：枚举类型转哈希值。
  参数：anyenum类型的数据。
  返回值类型：integer
  示例：
  ```
  openGauss=# CREATE TYPE b1 AS ENUM('good', 'bad', 'ugly');
  CREATE TYPE
  openGauss=# CALL hashenum('good'::b1);
    hashenum  
  ------------
   1821213359
  (1 row)
  openGauss=#  DROP TYPE b1;
  DROP TYPE
  ```
  
- hashfloat4(real) 描述：float4转哈希值。
  参数：real类型的数据。
  返回值类型：integer
  示例：
  ```
  openGauss=# SELECT hashfloat4(12.1234);
   hashfloat4 
  ------------
   1398514061
  (1 row)
  ```
  
- hashfloat8(double precision) 描述：float8转哈希值。
  参数：double precision类型的数据。
  返回值类型：integer
  示例：
  ```
  openGauss=# SELECT hashfloat8(123456.1234);
   hashfloat8 
  ------------
   1673665593
  (1 row)
  ```
  
- hashinet(inet) 描述：支持inet / cidr上的哈希索引的功能。返回传入inet的hash值。
  参数：inet类型的数据。
  返回值类型：integer
  示例：
  ```
  openGauss=# SELECT hashinet('127.0.0.1'::inet);
    hashinet   
  -------------
   -1435793109
  (1 row)
  ```
  
- hashint1(tinyint) 描述：INT1转哈希值。
  参数：tinyint类型的数据。
  返回值类型：uint32
  示例：
  ```
  openGauss=# SELECT hashint1(20);
    hashint1   
  -------------
   -2014641093
  (1 row)
  ```
  
- hashint2(smallint) 描述：INT2转哈希值。
  参数：smallint类型的数据。
  返回值类型：uint32
  示例：
  ```
  openGauss=# SELECT hashint2(20000);
    hashint2  
  ------------
   -863179081
  (1 row)
  ```
  
 
