This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new 19026e48e10 [doc] add docs for levenshtein and hamming_distance (#3324)
19026e48e10 is described below
commit 19026e48e10f65f6de011c3a009a5dede36e60c0
Author: 收集群风 <[email protected]>
AuthorDate: Thu Mar 19 16:12:59 2026 +0800
[doc] add docs for levenshtein and hamming_distance (#3324)
## Versions
- [x] dev
- [x] 4.x
- [ ] 3.x
- [ ] 2.1
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [x] Checked by AI
- [ ] Test Cases Built
---
.../string-functions/hamming_distance.md | 33 ++++++++++++++++++++++
.../string-functions/levenshtein.md | 33 ++++++++++++++++++++++
.../string-functions/hamming_distance.md | 33 ++++++++++++++++++++++
.../string-functions/levenshtein.md | 33 ++++++++++++++++++++++
.../string-functions/hamming_distance.md | 33 ++++++++++++++++++++++
.../string-functions/levenshtein.md | 33 ++++++++++++++++++++++
.../string-functions/hamming_distance.md | 33 ++++++++++++++++++++++
.../string-functions/levenshtein.md | 33 ++++++++++++++++++++++
versioned_sidebars/version-4.x-sidebars.json | 2 ++
9 files changed, 266 insertions(+)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
b/docs/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
new file mode 100644
index 00000000000..d3cc1f50297
--- /dev/null
+++
b/docs/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
@@ -0,0 +1,33 @@
+---
+title: HAMMING_DISTANCE
+---
+
+## Description
+The `HAMMING_DISTANCE` function returns the number of positions at which two
strings of equal length differ.
+
+This function counts characters in UTF-8.
+
+## Syntax
+```sql
+HAMMING_DISTANCE(<str1>, <str2>)
+```
+
+## Parameters
+| Parameter | Description |
+| -- | -- |
+| `<str1>` | First string |
+| `<str2>` | Second string |
+
+## Return Value
+Returns a BIGINT value.
+
+## Examples
+```sql
+SELECT hamming_distance('karolin', 'kathrin'); -- 3
+SELECT hamming_distance('数据库', '数据仓'); -- 1
+```
+
+## Notes
+- The two strings must have the same length. Otherwise, an error is returned.
+- Supports UTF-8 characters.
+- NULL input returns NULL.
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
b/docs/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
new file mode 100644
index 00000000000..9c161ed4c04
--- /dev/null
+++
b/docs/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
@@ -0,0 +1,33 @@
+---
+title: LEVENSHTEIN
+---
+
+## Description
+The `LEVENSHTEIN` function returns the Levenshtein edit distance between two
strings.
+The distance is the minimum number of single-character insertions, deletions,
or substitutions required to transform one string into the other.
+
+This function counts characters in UTF-8.
+
+## Syntax
+```sql
+LEVENSHTEIN(<str1>, <str2>)
+```
+
+## Parameters
+| Parameter | Description |
+| -- | -- |
+| `<str1>` | First string |
+| `<str2>` | Second string |
+
+## Return Value
+Returns an INT value.
+
+## Examples
+```sql
+SELECT levenshtein('kitten', 'sitting'); -- 3
+SELECT levenshtein('数据库', '数据'); -- 1
+```
+
+## Notes
+- Supports UTF-8 characters.
+- NULL input returns NULL.
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
new file mode 100644
index 00000000000..64a2136352d
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
@@ -0,0 +1,33 @@
+---
+title: HAMMING_DISTANCE
+---
+
+## 描述
+`HAMMING_DISTANCE` 函数用于计算两个**等长字符串**在对应位置上不同字符的个数。
+
+该函数按 UTF-8 字符计数。
+
+## 语法
+```sql
+HAMMING_DISTANCE(<str1>, <str2>)
+```
+
+## 参数
+| 参数 | 说明 |
+| -- | -- |
+| `<str1>` | 第一个字符串 |
+| `<str2>` | 第二个字符串 |
+
+## 返回值
+返回 BIGINT。
+
+## 示例
+```sql
+SELECT hamming_distance('karolin', 'kathrin'); -- 3
+SELECT hamming_distance('数据库', '数据仓'); -- 1
+```
+
+## 说明
+- 两个字符串必须长度一致,否则会报错。
+- 支持 UTF-8 字符。
+- 任意参数为 NULL 时返回 NULL。
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
new file mode 100644
index 00000000000..bbd1eb5d93f
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
@@ -0,0 +1,33 @@
+---
+title: LEVENSHTEIN
+---
+
+## 描述
+`LEVENSHTEIN` 函数用于计算两个字符串之间的编辑距离。
+编辑距离是把一个字符串变成另一个字符串所需的最少单字符插入、删除或替换次数。
+
+该函数按 UTF-8 字符计数。
+
+## 语法
+```sql
+LEVENSHTEIN(<str1>, <str2>)
+```
+
+## 参数
+| 参数 | 说明 |
+| -- | -- |
+| `<str1>` | 第一个字符串 |
+| `<str2>` | 第二个字符串 |
+
+## 返回值
+返回 INT。
+
+## 示例
+```sql
+SELECT levenshtein('kitten', 'sitting'); -- 3
+SELECT levenshtein('数据库', '数据'); -- 1
+```
+
+## 说明
+- 支持 UTF-8 字符。
+- 任意参数为 NULL 时返回 NULL。
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
new file mode 100644
index 00000000000..64a2136352d
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
@@ -0,0 +1,33 @@
+---
+title: HAMMING_DISTANCE
+---
+
+## 描述
+`HAMMING_DISTANCE` 函数用于计算两个**等长字符串**在对应位置上不同字符的个数。
+
+该函数按 UTF-8 字符计数。
+
+## 语法
+```sql
+HAMMING_DISTANCE(<str1>, <str2>)
+```
+
+## 参数
+| 参数 | 说明 |
+| -- | -- |
+| `<str1>` | 第一个字符串 |
+| `<str2>` | 第二个字符串 |
+
+## 返回值
+返回 BIGINT。
+
+## 示例
+```sql
+SELECT hamming_distance('karolin', 'kathrin'); -- 3
+SELECT hamming_distance('数据库', '数据仓'); -- 1
+```
+
+## 说明
+- 两个字符串必须长度一致,否则会报错。
+- 支持 UTF-8 字符。
+- 任意参数为 NULL 时返回 NULL。
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
new file mode 100644
index 00000000000..bbd1eb5d93f
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
@@ -0,0 +1,33 @@
+---
+title: LEVENSHTEIN
+---
+
+## 描述
+`LEVENSHTEIN` 函数用于计算两个字符串之间的编辑距离。
+编辑距离是把一个字符串变成另一个字符串所需的最少单字符插入、删除或替换次数。
+
+该函数按 UTF-8 字符计数。
+
+## 语法
+```sql
+LEVENSHTEIN(<str1>, <str2>)
+```
+
+## 参数
+| 参数 | 说明 |
+| -- | -- |
+| `<str1>` | 第一个字符串 |
+| `<str2>` | 第二个字符串 |
+
+## 返回值
+返回 INT。
+
+## 示例
+```sql
+SELECT levenshtein('kitten', 'sitting'); -- 3
+SELECT levenshtein('数据库', '数据'); -- 1
+```
+
+## 说明
+- 支持 UTF-8 字符。
+- 任意参数为 NULL 时返回 NULL。
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
new file mode 100644
index 00000000000..d3cc1f50297
--- /dev/null
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance.md
@@ -0,0 +1,33 @@
+---
+title: HAMMING_DISTANCE
+---
+
+## Description
+The `HAMMING_DISTANCE` function returns the number of positions at which two
strings of equal length differ.
+
+This function counts characters in UTF-8.
+
+## Syntax
+```sql
+HAMMING_DISTANCE(<str1>, <str2>)
+```
+
+## Parameters
+| Parameter | Description |
+| -- | -- |
+| `<str1>` | First string |
+| `<str2>` | Second string |
+
+## Return Value
+Returns a BIGINT value.
+
+## Examples
+```sql
+SELECT hamming_distance('karolin', 'kathrin'); -- 3
+SELECT hamming_distance('数据库', '数据仓'); -- 1
+```
+
+## Notes
+- The two strings must have the same length. Otherwise, an error is returned.
+- Supports UTF-8 characters.
+- NULL input returns NULL.
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
new file mode 100644
index 00000000000..9c161ed4c04
--- /dev/null
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/levenshtein.md
@@ -0,0 +1,33 @@
+---
+title: LEVENSHTEIN
+---
+
+## Description
+The `LEVENSHTEIN` function returns the Levenshtein edit distance between two
strings.
+The distance is the minimum number of single-character insertions, deletions,
or substitutions required to transform one string into the other.
+
+This function counts characters in UTF-8.
+
+## Syntax
+```sql
+LEVENSHTEIN(<str1>, <str2>)
+```
+
+## Parameters
+| Parameter | Description |
+| -- | -- |
+| `<str1>` | First string |
+| `<str2>` | Second string |
+
+## Return Value
+Returns an INT value.
+
+## Examples
+```sql
+SELECT levenshtein('kitten', 'sitting'); -- 3
+SELECT levenshtein('数据库', '数据'); -- 1
+```
+
+## Notes
+- Supports UTF-8 characters.
+- NULL input returns NULL.
diff --git a/versioned_sidebars/version-4.x-sidebars.json
b/versioned_sidebars/version-4.x-sidebars.json
index 75d0d6543a2..c5c2578df70 100644
--- a/versioned_sidebars/version-4.x-sidebars.json
+++ b/versioned_sidebars/version-4.x-sidebars.json
@@ -1394,6 +1394,7 @@
"sql-manual/sql-functions/scalar-functions/string-functions/first-significant-subdomain",
"sql-manual/sql-functions/scalar-functions/string-functions/format",
"sql-manual/sql-functions/scalar-functions/string-functions/format-number",
+
"sql-manual/sql-functions/scalar-functions/string-functions/hamming_distance",
"sql-manual/sql-functions/scalar-functions/string-functions/hex",
"sql-manual/sql-functions/scalar-functions/string-functions/initcap",
"sql-manual/sql-functions/scalar-functions/string-functions/instr",
@@ -1401,6 +1402,7 @@
"sql-manual/sql-functions/scalar-functions/string-functions/is-uuid",
"sql-manual/sql-functions/scalar-functions/string-functions/lcase",
"sql-manual/sql-functions/scalar-functions/string-functions/length",
+
"sql-manual/sql-functions/scalar-functions/string-functions/levenshtein",
"sql-manual/sql-functions/scalar-functions/string-functions/locate",
"sql-manual/sql-functions/scalar-functions/string-functions/lpad",
"sql-manual/sql-functions/scalar-functions/string-functions/ltrim",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]