From 6cd3504a49c269207a7df512715895d0af40c986 Mon Sep 17 00:00:00 2001 From: Philip Date: Sun, 30 Aug 2026 20:15:34 +0100 Subject: [PATCH] adding docs for 128 bit xxhash --- .../encrypt-digest-functions/xxhash-128.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-128.md diff --git a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-128.md b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-128.md new file mode 100644 index 0000000000000..61f3216ec325f --- /dev/null +++ b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-128.md @@ -0,0 +1,69 @@ +--- +{ + "title": "XXHASH_128", + "language": "en", + "description": "Calculate the 128-bit xxhash value of the input string or binary." +} +--- + +## Description + +Calculate the 128-bit xxhash value of the input string or binary. + +## Syntax + +```sql +XXHASH_128( [ , ... ] ) +``` + +## Parameters + +| parameter | description | +|-----------|------------------| +| `` | The 128-bit xxhash value to be calculated, accept string and binary types | + +## Return Value + +Returns the 128-bit xxhash value of the input string. + +## Examples + +```sql +select xxhash_128(NULL), xxhash_128("hello"), xxhash_128("hello", "world"); +``` + +```text ++------------------+-----------------------------------------+----------------------------------------+ +| xxhash_128(NULL) | xxhash_128("hello") | xxhash_128("hello", "world") | ++------------------+-----------------------------------------+----------------------------------------+ +| NULL | -98478366302105124680504504609445627880 | -9508340982777299797928774324431085410 | ++------------------+-----------------------------------------+----------------------------------------+ +``` + +```sql +-- vb (VarBinary) and vc (VarChar) used the same string during insertion. +SELECT * FROM mysql_catalog.binary_test.binary_test; +``` +```text ++------+------------+------+ +| id | vb | vc | ++------+------------+------+ +| 1 | 0x616263 | abc | +| 2 | 0x78797A | xyz | +| 3 | NULL | NULL | ++------+------------+------+ +``` + +```sql +SELECT XXHASH_128(vb), XXHASH_128(vc) FROM mysql_catalog.binary_test.binary_test; +``` +```text ++-----------------------------------------+-----------------------------------------+ +| XXHASH_128(vb) | XXHASH_128(vc) | ++-----------------------------------------+-----------------------------------------+ +| 8891052093862885505146213044715469136 | 8891052093862885505146213044715469136 | +| -14492046026574147306325126754808553697 | -14492046026574147306325126754808553697 | +| NULL | NULL | ++-----------------------------------------+-----------------------------------------+ +``` +