Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
{
"title": "MURMUR_HASH3_64_V2",
"language": "en"
}
---

## Description

Computes a 64-bit MurmurHash3 hash value.

The difference from `MURMUR_HASH3_64` is: this version reuses the 128-bit processing function of MurmurHash3, outputting only the first 64-bit hash value, which is consistent with the [standard library](https://mmh3.readthedocs.io/en/latest/api.html#mmh3.hash64) implementation.

Note: According to testing, the performance of `xxhash_64` is approximately 2 times that of `murmur_hash3_64`. Therefore, when calculating hash values, it is recommended to use `xxhash_64` instead of `murmur_hash3_64`.

## Syntax

```sql
MURMUR_HASH3_64_V2( <str> [ , <str> ... ] )
```

## Parameters

| Parameter | Description |
| --------- | ----------------------------------------------------- |
| `<str>` | The value to be computed as a 64-bit MurmurHash3 hash |

## Return Value

Returns the 64-bit MurmurHash3 hash value of the input string.

Returns NULL if any parameter is NULL.

## Examples

```sql
select murmur_hash3_64_v2(null), murmur_hash3_64_v2("hello"), murmur_hash3_64_v2("hello", "world");
```

```text
+--------------------------+-----------------------------+--------------------------------------+
| murmur_hash3_64_v2(null) | murmur_hash3_64_v2("hello") | murmur_hash3_64_v2("hello", "world") |
+--------------------------+-----------------------------+--------------------------------------+
| NULL | -3758069500696749310 | -662943091231200135 |
+--------------------------+-----------------------------+--------------------------------------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

Calculate 64-bit murmur3 hash value

The difference from `MURMUR_HASH3_64_V2` is: This version is specifically optimized for 64-bit output, with slightly better performance than the v2 version, but is inconsistent with the [standard library](https://mmh3.readthedocs.io/en/latest/api.html#mmh3.hash64) implementation.

-Note: After testing, the performance of `xxhash_64` is about twice that of `murmur_hash3_64`, so when calculating hash values, it is recommended to use `xxhash_64` instead of `murmur_hash3_64`.


Expand All @@ -28,7 +30,7 @@ MURMUR_HASH3_64( <str> [ , <str> ... ] )

Returns the 64-bit murmur3 hash of the input string.


Returns NULL if any parameter input is NULL.

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Calculates the 64-bit xxhash value of the input string or binary.

-Note: After testing, the performance of `xxhash_64` is about twice that of `murmur_hash3_64`, so when calculating hash values, it is recommended to use `xxhash_64` instead of `murmur_hash3_64`.

## Alias

- `XXHASH3_64`

## Syntax

```sql
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
{
"title": "MURMUR_HASH3_64_V2",
"language": "zh-CN"
}
---

## 描述

计算 64 位 murmur3 hash 值

与`MURMUR_HASH3_64`的区别是:此版本复用 MurmurHash3 的 128 位处理函数,仅输出第一个 64 位哈希值,与[标准库](https://mmh3.readthedocs.io/en/latest/api.html#mmh3.hash64)的行为保持一致。

-注:经过测试 xxhash_64 的性能大约是 murmur_hash3_64_v2 的 2 倍,所以在计算 hash 值时,更推荐使用`xxhash_64`,而不是`murmur_hash3_64`。如需更优的 64 位 MurmurHash3 性能,可考虑使用 `murmur_hash3_64`。

## 语法

```sql
MURMUR_HASH3_64_V2( <str> [ , <str> ... ] )
```

## 参数

| 参数 | 说明 |
|---------|------------------------|
| `<str>` | 需要被计算 64 位 murmur3 hash 的值 |

## 返回值

返回输入字符串的 64 位 murmur3 hash 值。

任一参数为 NULL 时返回 NULL

## 示例

```sql
select murmur_hash3_64_v2(null), murmur_hash3_64_v2("hello"), murmur_hash3_64_v2("hello", "world");
```

```text
+-----------------------+--------------------------+-----------------------------------+
| murmur_hash3_64(NULL) | murmur_hash3_64('hello') | murmur_hash3_64('hello', 'world') |
+-----------------------+--------------------------+-----------------------------------+
| NULL | -3215607508166160593 | 3583109472027628045 |
+-----------------------+--------------------------+-----------------------------------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

计算 64 位 murmur3 hash 值

与`MURMUR_HASH3_64_V2`的区别是:此版本专门为 64 位输出优化,性能略优于 v2 版本, 但与[标准库](https://mmh3.readthedocs.io/en/latest/api.html#mmh3.hash64)实现不一致。

-注:经过测试 xxhash_64 的性能大约是 murmur_hash3_64 的 2 倍,所以在计算 hash 值时,更推荐使用`xxhash_64`,而不是`murmur_hash3_64`。

## 语法
Expand All @@ -27,6 +29,8 @@ MURMUR_HASH3_64( <str> [ , <str> ... ] )

返回输入字符串的 64 位 murmur3 hash 值。

任一参数输入为 NULL 时返回 NULL。

## 示例

```sql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

-注:经过测试 xxhash_64 的性能大约是 murmur_hash3_64 的 2 倍,所以在计算 hash 值时,更推荐使用`xxhash_64`,而不是`murmur_hash3_64`。

## 别名

- `XXHASH3_64`

## 语法

```sql
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
{
"title": "MURMUR_HASH3_64_V2",
"language": "zh-CN"
}
---

## 描述

计算 64 位 murmur3 hash 值

与`MURMUR_HASH3_64`的区别是:此版本复用 MurmurHash3 的 128 位处理函数,仅输出第一个 64 位哈希值,与[标准库](https://mmh3.readthedocs.io/en/latest/api.html#mmh3.hash64)的行为保持一致。

-注:经过测试 xxhash_64 的性能大约是 murmur_hash3_64_v2 的 2 倍,所以在计算 hash 值时,更推荐使用`xxhash_64`,而不是`murmur_hash3_64`。

## 语法

```sql
MURMUR_HASH3_64_V2( <str> [ , <str> ... ] )
```

## 参数

| 参数 | 说明 |
|---------|------------------------|
| `<str>` | 需要被计算 64 位 murmur3 hash 的值 |

## 返回值

返回输入字符串的 64 位 murmur3 hash 值。

任一参数为 NULL 时返回 NULL

## 示例

```sql
select murmur_hash3_64_v2(null), murmur_hash3_64_v2("hello"), murmur_hash3_64_v2("hello", "world");
```

```text
+-----------------------+--------------------------+-----------------------------------+
| murmur_hash3_64(NULL) | murmur_hash3_64('hello') | murmur_hash3_64('hello', 'world') |
+-----------------------+--------------------------+-----------------------------------+
| NULL | -3215607508166160593 | 3583109472027628045 |
+-----------------------+--------------------------+-----------------------------------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

计算 64 位 murmur3 hash 值

与`MURMUR_HASH3_64_V2`的区别是:此版本专门为 64 位输出优化,性能略优于 v2 版本, 但与[标准库](https://mmh3.readthedocs.io/en/latest/api.html#mmh3.hash64)实现不一致。

-注:经过测试 xxhash_64 的性能大约是 murmur_hash3_64 的 2 倍,所以在计算 hash 值时,更推荐使用`xxhash_64`,而不是`murmur_hash3_64`。

## 语法
Expand All @@ -27,7 +29,7 @@ MURMUR_HASH3_64( <str> [ , <str> ... ] )

返回输入字符串的 64 位 murmur3 hash 值。


任一参数输入为 NULL 时返回 NULL。

## 示例

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

-注:经过测试 xxhash_64 的性能大约是 murmur_hash3_64 的 2 倍,所以在计算 hash 值时,更推荐使用`xxhash_64`,而不是`murmur_hash3_64`。

## 别名

- `XXHASH3_64`

## 语法

```sql
Expand Down
1 change: 1 addition & 0 deletions sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,7 @@
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/md5sum",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/murmur-hash3-32",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/murmur-hash3-64",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/murmur-hash3-64-v2",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha2",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sm3",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
{
"title": "MURMUR_HASH3_64_V2",
"language": "en"
}
---

## Description

Computes a 64-bit MurmurHash3 hash value.

The difference from `MURMUR_HASH3_64` is: this version reuses the 128-bit processing function of MurmurHash3, outputting only the first 64-bit hash value, which is consistent with the [standard library](https://mmh3.readthedocs.io/en/latest/api.html#mmh3.hash64) implementation.

Note: According to testing, the performance of `xxhash_64` is approximately 2 times that of `murmur_hash3_64`. Therefore, when calculating hash values, it is recommended to use `xxhash_64` instead of `murmur_hash3_64`. If better 64-bit MurmurHash3 performance is needed, consider using `murmur_hash3_64`.

## Syntax

```sql
MURMUR_HASH3_64_V2( <str> [ , <str> ... ] )
```

## Parameters

| Parameter | Description |
| --------- | ----------------------------------------------------- |
| `<str>` | The value to be computed as a 64-bit MurmurHash3 hash |

## Return Value

Returns the 64-bit MurmurHash3 hash value of the input string.

Returns NULL if any parameter is NULL.

## Examples

```sql
select murmur_hash3_64_v2(null), murmur_hash3_64_v2("hello"), murmur_hash3_64_v2("hello", "world");
```

```text
+--------------------------+-----------------------------+--------------------------------------+
| murmur_hash3_64_v2(null) | murmur_hash3_64_v2("hello") | murmur_hash3_64_v2("hello", "world") |
+--------------------------+-----------------------------+--------------------------------------+
| NULL | -3758069500696749310 | -662943091231200135 |
+--------------------------+-----------------------------+--------------------------------------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

Calculate 64-bit murmur3 hash value

The difference from `MURMUR_HASH3_64_V2` is: This version is specifically optimized for 64-bit output, with slightly better performance than the v2 version, but is inconsistent with the [standard library](https://mmh3.readthedocs.io/en/latest/api.html#mmh3.hash64) implementation.

-Note: After testing, the performance of `xxhash_64` is about twice that of `murmur_hash3_64`, so when calculating hash values, it is recommended to use `xxhash_64` instead of `murmur_hash3_64`.

## Syntax
Expand All @@ -27,7 +29,7 @@ MURMUR_HASH3_64( <str> [ , <str> ... ] )

Returns the 64-bit murmur3 hash of the input string.


Returns NULL if any parameter input is NULL.

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Calculates the 64-bit xxhash value of the input string

-Note: After testing, the performance of `xxhash_64` is about twice that of `murmur_hash3_64`, so when calculating hash values, it is recommended to use `xxhash_64` instead of `murmur_hash3_64`.

## Alias

- `XXHASH3_64`

## Syntax

```sql
Expand Down
1 change: 1 addition & 0 deletions versioned_sidebars/version-3.x-sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,7 @@
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/md5sum",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/murmur-hash3-32",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/murmur-hash3-64",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/murmur-hash3-64-v2",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha2",
"sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sm3",
Expand Down
Loading