This is an automated email from the ASF dual-hosted git repository.
panxiaolei 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 82590396a48 docs: add corr_welford documentation (#2705)
82590396a48 is described below
commit 82590396a48bc9aadf3f290ba4947319a9a3ca9a
Author: Mryange <[email protected]>
AuthorDate: Tue Aug 5 16:28:44 2025 +0800
docs: add corr_welford documentation (#2705)
## Versions
- [x] dev
- [x] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../aggregate-functions/corr-welford.md | 67 ++++++++++++++++++++++
.../sql-functions/window-functions/corr-welford.md | 1 +
.../aggregate-functions/corr-welford.md | 67 ++++++++++++++++++++++
.../sql-functions/window-functions/corr-welford.md | 1 +
.../aggregate-functions/corr-welford.md | 67 ++++++++++++++++++++++
sidebars.json | 2 +
.../aggregate-functions/corr-welford.md | 67 ++++++++++++++++++++++
versioned_sidebars/version-3.0-sidebars.json | 1 +
8 files changed, 273 insertions(+)
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/corr-welford.md
b/docs/sql-manual/sql-functions/aggregate-functions/corr-welford.md
new file mode 100755
index 00000000000..77cbac9d0ff
--- /dev/null
+++ b/docs/sql-manual/sql-functions/aggregate-functions/corr-welford.md
@@ -0,0 +1,67 @@
+---
+{
+ "title": "CORR_WELFORD",
+ "language": "en"
+}
+---
+
+## Description
+
+Calculate the Pearson coefficient of two random variables using the
[Welford](https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm)
algorithm, which can effectively reduce calculation errors.
+
+## Syntax
+
+```sql
+CORR_WELFORD(<expr1>, <expr2>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<expr1>` | Double expression (column) |
+| `<expr2>` | Double expression (column) |
+
+## Return Value
+
+The return value is of type DOUBLE, the covariance of expr1 and expr2, except
the product of the standard deviation of expr1 and expr2, special case:
+
+- If the standard deviation of expr1 or expr2 is 0, 0 will be returned.
+- If a column of expr1 or expr2 is NULL, the row data will not be counted in
the final result.
+
+## Example
+
+```sql
+select * from test_corr;
+```
+
+```text
++------+------+------+
+| id | k1 | k2 |
++------+------+------+
+| 1 | 20 | 22 |
+| 1 | 10 | 20 |
+| 2 | 36 | 21 |
+| 2 | 30 | 22 |
+| 2 | 25 | 20 |
+| 3 | 25 | NULL |
+| 4 | 25 | 21 |
+| 4 | 25 | 22 |
+| 4 | 25 | 20 |
++------+------+------+
+```
+
+```sql
+select id,corr_welford(k1,k2) from test_corr group by id;
+```
+
+```text
++------+---------------------+
+| id | corr_welford(k1,k2) |
++------+---------------------+
+| 2 | 0.4539206495016017 |
+| 4 | 0 |
+| 3 | NULL |
+| 1 | 1 |
++------+---------------------+
+```
diff --git a/docs/sql-manual/sql-functions/window-functions/corr-welford.md
b/docs/sql-manual/sql-functions/window-functions/corr-welford.md
new file mode 120000
index 00000000000..5fb8d93f94f
--- /dev/null
+++ b/docs/sql-manual/sql-functions/window-functions/corr-welford.md
@@ -0,0 +1 @@
+../aggregate-functions/corr-welford.md
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/corr-welford.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/corr-welford.md
new file mode 100644
index 00000000000..38f0b1c1ace
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/corr-welford.md
@@ -0,0 +1,67 @@
+---
+{
+"title": "CORR_WELFORD",
+"language": "zh-CN"
+}
+---
+
+## 描述
+
+采用
[Welford](https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm)
算法计算两个随机变量的皮尔逊系数,能够有效降低计算误差。
+
+## 语法
+
+```sql
+CORR_WELFORD(<expr1>, <expr2>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| -- | -- |
+| `<expr1>` | Double 表达式(列) |
+| `<expr2>` | Double 表达式(列) |
+
+## 返回值
+
+返回值为 DOUBLE 类型,expr1 和 expr2 的协方差,除 expr1 和 expr2 的标准差乘积,特殊情况:
+
+- 如果 expr1 或 expr2 的标准差为 0, 将返回 0。
+- 如果 expr1 或者 expr2 某一列为 NULL 时,该行数据不会被统计到最终结果中。
+
+## 举例
+
+```sql
+select * from test_corr;
+```
+
+```text
++------+------+------+
+| id | k1 | k2 |
++------+------+------+
+| 1 | 20 | 22 |
+| 1 | 10 | 20 |
+| 2 | 36 | 21 |
+| 2 | 30 | 22 |
+| 2 | 25 | 20 |
+| 3 | 25 | NULL |
+| 4 | 25 | 21 |
+| 4 | 25 | 22 |
+| 4 | 25 | 20 |
++------+------+------+
+```
+
+```sql
+select id,corr_welford(k1,k2) from test_corr group by id;
+```
+
+```text
++------+---------------------+
+| id | corr_welford(k1,k2) |
++------+---------------------+
+| 2 | 0.4539206495016017 |
+| 4 | 0 |
+| 3 | NULL |
+| 1 | 1 |
++------+---------------------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/window-functions/corr-welford.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/window-functions/corr-welford.md
new file mode 120000
index 00000000000..5fb8d93f94f
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/window-functions/corr-welford.md
@@ -0,0 +1 @@
+../aggregate-functions/corr-welford.md
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/aggregate-functions/corr-welford.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/aggregate-functions/corr-welford.md
new file mode 100644
index 00000000000..38f0b1c1ace
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/aggregate-functions/corr-welford.md
@@ -0,0 +1,67 @@
+---
+{
+"title": "CORR_WELFORD",
+"language": "zh-CN"
+}
+---
+
+## 描述
+
+采用
[Welford](https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm)
算法计算两个随机变量的皮尔逊系数,能够有效降低计算误差。
+
+## 语法
+
+```sql
+CORR_WELFORD(<expr1>, <expr2>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| -- | -- |
+| `<expr1>` | Double 表达式(列) |
+| `<expr2>` | Double 表达式(列) |
+
+## 返回值
+
+返回值为 DOUBLE 类型,expr1 和 expr2 的协方差,除 expr1 和 expr2 的标准差乘积,特殊情况:
+
+- 如果 expr1 或 expr2 的标准差为 0, 将返回 0。
+- 如果 expr1 或者 expr2 某一列为 NULL 时,该行数据不会被统计到最终结果中。
+
+## 举例
+
+```sql
+select * from test_corr;
+```
+
+```text
++------+------+------+
+| id | k1 | k2 |
++------+------+------+
+| 1 | 20 | 22 |
+| 1 | 10 | 20 |
+| 2 | 36 | 21 |
+| 2 | 30 | 22 |
+| 2 | 25 | 20 |
+| 3 | 25 | NULL |
+| 4 | 25 | 21 |
+| 4 | 25 | 22 |
+| 4 | 25 | 20 |
++------+------+------+
+```
+
+```sql
+select id,corr_welford(k1,k2) from test_corr group by id;
+```
+
+```text
++------+---------------------+
+| id | corr_welford(k1,k2) |
++------+---------------------+
+| 2 | 0.4539206495016017 |
+| 4 | 0 |
+| 3 | NULL |
+| 1 | 1 |
++------+---------------------+
+```
diff --git a/sidebars.json b/sidebars.json
index 5ccf436ed3a..4cd8c045bca 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1691,6 +1691,7 @@
"sql-manual/sql-functions/aggregate-functions/bitmap-union-int",
"sql-manual/sql-functions/aggregate-functions/collect-list",
"sql-manual/sql-functions/aggregate-functions/collect-set",
+
"sql-manual/sql-functions/aggregate-functions/corr-welford",
"sql-manual/sql-functions/aggregate-functions/corr",
"sql-manual/sql-functions/aggregate-functions/count",
"sql-manual/sql-functions/aggregate-functions/count-by-enum",
@@ -1780,6 +1781,7 @@
"sql-manual/sql-functions/window-functions/bitmap-union-int",
"sql-manual/sql-functions/window-functions/collect-list",
"sql-manual/sql-functions/window-functions/collect-set",
+
"sql-manual/sql-functions/window-functions/corr-welford",
"sql-manual/sql-functions/window-functions/corr",
"sql-manual/sql-functions/window-functions/count",
"sql-manual/sql-functions/window-functions/count-by-enum",
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/aggregate-functions/corr-welford.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/aggregate-functions/corr-welford.md
new file mode 100644
index 00000000000..1722322485c
--- /dev/null
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/aggregate-functions/corr-welford.md
@@ -0,0 +1,67 @@
+---
+{
+"title": "CORR_WELFORD",
+"language": "en"
+}
+---
+
+## Description
+
+Calculate the Pearson coefficient of two random variables using the
[Welford](https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm)
algorithm, which can effectively reduce calculation errors.
+
+## Syntax
+
+```sql
+CORR_WELFORD(<expr1>, <expr2>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<expr1>` | Double expression (column) |
+| `<expr2>` | Double expression (column) |
+
+## Return Value
+
+The return value is of type DOUBLE, the covariance of expr1 and expr2, except
the product of the standard deviation of expr1 and expr2, special case:
+
+- If the standard deviation of expr1 or expr2 is 0, 0 will be returned.
+- If a column of expr1 or expr2 is NULL, the row data will not be counted in
the final result.
+
+## Example
+
+```sql
+select * from test_corr;
+```
+
+```text
++------+------+------+
+| id | k1 | k2 |
++------+------+------+
+| 1 | 20 | 22 |
+| 1 | 10 | 20 |
+| 2 | 36 | 21 |
+| 2 | 30 | 22 |
+| 2 | 25 | 20 |
+| 3 | 25 | NULL |
+| 4 | 25 | 21 |
+| 4 | 25 | 22 |
+| 4 | 25 | 20 |
++------+------+------+
+```
+
+```sql
+select id,corr_welford(k1,k2) from test_corr group by id;
+```
+
+```text
++------+---------------------+
+| id | corr_welford(k1,k2) |
++------+---------------------+
+| 2 | 0.4539206495016017 |
+| 4 | 0 |
+| 3 | NULL |
+| 1 | 1 |
++------+---------------------+
+```
diff --git a/versioned_sidebars/version-3.0-sidebars.json
b/versioned_sidebars/version-3.0-sidebars.json
index 853d4da8fe5..e35fb7eab40 100644
--- a/versioned_sidebars/version-3.0-sidebars.json
+++ b/versioned_sidebars/version-3.0-sidebars.json
@@ -1629,6 +1629,7 @@
"sql-manual/sql-functions/aggregate-functions/bitmap-union-int",
"sql-manual/sql-functions/aggregate-functions/collect-list",
"sql-manual/sql-functions/aggregate-functions/collect-set",
+
"sql-manual/sql-functions/aggregate-functions/corr-welford",
"sql-manual/sql-functions/aggregate-functions/corr",
"sql-manual/sql-functions/aggregate-functions/count",
"sql-manual/sql-functions/aggregate-functions/count-by-enum",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]