This is an automated email from the ASF dual-hosted git repository.
zclll 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 66db103aca8 [docs](function) support aggregrate function regr_slope
regr_intercept (#2443)
66db103aca8 is described below
commit 66db103aca8b3bc49a018eb8fbf36d5583832127
Author: zclllyybb <[email protected]>
AuthorDate: Thu Jun 5 20:33:32 2025 +0800
[docs](function) support aggregrate function regr_slope regr_intercept
(#2443)
## Versions
- [x] dev
- [x] 3.0
Co-authored-by: yoruet <[email protected]>
---
.../aggregate-functions/regr_intercept.md | 62 ++++++++++++++++++++++
.../aggregate-functions/regr_slope.md | 62 ++++++++++++++++++++++
.../aggregate-functions/regr_intercept.md | 62 ++++++++++++++++++++++
.../aggregate-functions/regr_slope.md | 62 ++++++++++++++++++++++
.../aggregate-functions/regr_intercept.md | 62 ++++++++++++++++++++++
.../aggregate-functions/regr_slope.md | 62 ++++++++++++++++++++++
sidebars.json | 2 +
.../aggregate-functions/regr_intercept.md | 62 ++++++++++++++++++++++
.../aggregate-functions/regr_slope.md | 62 ++++++++++++++++++++++
versioned_sidebars/version-3.0-sidebars.json | 2 +
10 files changed, 500 insertions(+)
diff --git
a/docs/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
b/docs/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
new file mode 100644
index 00000000000..e1e9d69bbd3
--- /dev/null
+++ b/docs/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
@@ -0,0 +1,62 @@
+---
+{
+ "title": "REGR_INTERCEPT",
+ "language": "en"
+}
+---
+
+## Description
+REGR_INTERCEPT is used to calculate the y-intercept of the least squares-fit
linear equation for a set of number pairs.
+
+## Syntax
+```
+REGR_INTERCEPT(y, x)
+```
+
+## Parameters
+- `y` (Numeric): The dependent variable.
+- `x` (Numeric): The independent variable.
+
+Both `x` and `y` support basic numeric types.
+
+## Returned values
+Returned data type: FLOAT64
+
+The function returns the y-intercept of the linear regression line.
+
+If there are no rows, or only rows with null values, the function returns NULL.
+
+## Examples
+```sql
+-- Example 1: Basic Usage
+SELECT regr_intercept(y, x) FROM test;
+
+-- Example 2: Usage in a query with sample data
+SELECT * FROM test;
++------+------+------+
+| id | x | y |
++------+------+------+
+| 1 | 18 | 13 |
+| 3 | 12 | 2 |
+| 5 | 10 | 20 |
+| 2 | 14 | 27 |
+| 4 | 5 | 6 |
++------+------+------+
+
+SELECT regr_intercept(y, x) FROM test;
++----------------------+
+| regr_intercept(y, x) |
++----------------------+
+| 5.512931034482759 |
++----------------------+
+```
+
+## Usage notes
+- This function ignores any pair where either value is null.
+- In cases where the calculation would result in a division by zero, the
function will return NULL.
+
+## Related functions
+REGR_SLOPE, REGR_R2, REGR_COUNT, REGR_AVGX, REGR_AVGY
+
+## References
+For more details about linear regression functions, please refer to the SQL
standard documentation on aggregate functions.
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/regr_slope.md
b/docs/sql-manual/sql-functions/aggregate-functions/regr_slope.md
new file mode 100644
index 00000000000..85a090be310
--- /dev/null
+++ b/docs/sql-manual/sql-functions/aggregate-functions/regr_slope.md
@@ -0,0 +1,62 @@
+---
+{
+ "title": "REGR_SLOPE",
+ "language": "en"
+}
+---
+
+## Description
+REGR_SLOPE is used to calculate the slope of the least squares-fit linear
equation for a set of number pairs.
+
+## Syntax
+```
+REGR_SLOPE(y, x)
+```
+
+## Parameters
+- `y` (Numeric): The dependent variable.
+- `x` (Numeric): The independent variable.
+
+Both `x` and `y` support basic numeric types.
+
+## Returned values
+Returned data type: FLOAT64
+
+The function returns the slope of the linear regression line.
+
+If there are no rows, or only rows with null values, the function returns NULL.
+
+## Examples
+```sql
+-- Example 1: Basic Usage
+SELECT regr_slope(y, x) FROM test;
+
+-- Example 2: Usage in a query with sample data
+SELECT * FROM test;
++------+------+------+
+| id | x | y |
++------+------+------+
+| 1 | 18 | 13 |
+| 3 | 12 | 2 |
+| 5 | 10 | 20 |
+| 2 | 14 | 27 |
+| 4 | 5 | 6 |
++------+------+------+
+
+SELECT regr_slope(y, x) FROM test;
++--------------------+
+| regr_slope(y, x) |
++--------------------+
+| 0.6853448275862069 |
++--------------------+
+```
+
+## Usage notes
+- This function ignores any pair where either value is null.
+- In cases where the calculation would result in a division by zero, the
function will return NULL.
+
+## Related functions
+REGR_INTERCEPT, REGR_R2, REGR_COUNT, REGR_AVGX, REGR_AVGY
+
+## References
+For more details about linear regression functions, please refer to the SQL
standard documentation on aggregate functions.
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
new file mode 100644
index 00000000000..a619daac246
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
@@ -0,0 +1,62 @@
+---
+{
+ "title": "REGR_INTERCEPT",
+ "language": "zh-CN"
+}
+---
+
+## Description
+REGR_INTERCEPT 用于计算一组数值对的最小二乘拟合线性方程的截距。
+
+## Syntax
+```
+REGR_INTERCEPT(y, x)
+```
+
+## Parameters
+- `y` (数值类型):因变量。
+- `x` (数值类型):自变量。
+
+x 和 y 都支持基本数值类型。
+
+## Returned values
+返回数据类型:FLOAT64
+
+函数返回线性回归直线的截距。
+
+如果没有行,或者只有包含空值的行,函数返回 NULL。
+
+## Examples
+```sql
+-- 示例 1:基本用法
+SELECT regr_intercept(y, x) FROM test;
+
+-- 示例 2:在查询中使用示例数据
+SELECT * FROM test;
++------+------+------+
+| id | x | y |
++------+------+------+
+| 1 | 18 | 13 |
+| 3 | 12 | 2 |
+| 5 | 10 | 20 |
+| 2 | 14 | 27 |
+| 4 | 5 | 6 |
++------+------+------+
+
+SELECT regr_intercept(y, x) FROM test;
++----------------------+
+| regr_intercept(y, x) |
++----------------------+
+| 5.512931034482759 |
++----------------------+
+```
+
+## Usage notes
+- 此函数会忽略任何包含空值的数值对。
+- 在计算结果会导致除以零的情况下,函数将返回 NULL。
+
+## Related functions
+REGR_SLOPE, REGR_R2, REGR_COUNT, REGR_AVGX, REGR_AVGY
+
+## References
+有关线性回归函数的更多详细信息,请参阅 SQL 标准文档中关于聚合函数的部分。
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr_slope.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr_slope.md
new file mode 100644
index 00000000000..295ef814cab
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr_slope.md
@@ -0,0 +1,62 @@
+---
+{
+ "title": "REGR_SLOPE",
+ "language": "zh-CN"
+}
+---
+
+## Description
+REGR_SLOPE 用于计算一组数值对的最小二乘拟合线性方程的斜率。
+
+## Syntax
+```
+REGR_SLOPE(y, x)
+```
+
+## Parameters
+- `y` (数值类型):因变量。
+- `x` (数值类型):自变量。
+
+x 和 y 都支持基本数值类型。
+
+## Returned values
+返回数据类型:FLOAT64
+
+函数返回线性回归直线的斜率。
+
+如果没有行,或者只有包含空值的行,函数返回 NULL。
+
+## Examples
+```sql
+-- 示例 1:基本用法
+SELECT regr_slope(y, x) FROM test;
+
+-- 示例 2:在查询中使用示例数据
+SELECT * FROM test;
++------+------+------+
+| id | x | y |
++------+------+------+
+| 1 | 18 | 13 |
+| 3 | 12 | 2 |
+| 5 | 10 | 20 |
+| 2 | 14 | 27 |
+| 4 | 5 | 6 |
++------+------+------+
+
+SELECT regr_slope(y, x) FROM test;
++--------------------+
+| regr_slope(y, x) |
++--------------------+
+| 0.6853448275862069 |
++--------------------+
+```
+
+## Usage notes
+- 此函数会忽略任何包含空值的数值对。
+- 在计算结果会导致除以零的情况下,函数将返回 NULL。
+
+## Related functions
+REGR_INTERCEPT, REGR_R2, REGR_COUNT, REGR_AVGX, REGR_AVGY
+
+## References
+有关线性回归函数的更多详细信息,请参阅 SQL 标准文档中关于聚合函数的部分。
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
new file mode 100644
index 00000000000..a619daac246
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
@@ -0,0 +1,62 @@
+---
+{
+ "title": "REGR_INTERCEPT",
+ "language": "zh-CN"
+}
+---
+
+## Description
+REGR_INTERCEPT 用于计算一组数值对的最小二乘拟合线性方程的截距。
+
+## Syntax
+```
+REGR_INTERCEPT(y, x)
+```
+
+## Parameters
+- `y` (数值类型):因变量。
+- `x` (数值类型):自变量。
+
+x 和 y 都支持基本数值类型。
+
+## Returned values
+返回数据类型:FLOAT64
+
+函数返回线性回归直线的截距。
+
+如果没有行,或者只有包含空值的行,函数返回 NULL。
+
+## Examples
+```sql
+-- 示例 1:基本用法
+SELECT regr_intercept(y, x) FROM test;
+
+-- 示例 2:在查询中使用示例数据
+SELECT * FROM test;
++------+------+------+
+| id | x | y |
++------+------+------+
+| 1 | 18 | 13 |
+| 3 | 12 | 2 |
+| 5 | 10 | 20 |
+| 2 | 14 | 27 |
+| 4 | 5 | 6 |
++------+------+------+
+
+SELECT regr_intercept(y, x) FROM test;
++----------------------+
+| regr_intercept(y, x) |
++----------------------+
+| 5.512931034482759 |
++----------------------+
+```
+
+## Usage notes
+- 此函数会忽略任何包含空值的数值对。
+- 在计算结果会导致除以零的情况下,函数将返回 NULL。
+
+## Related functions
+REGR_SLOPE, REGR_R2, REGR_COUNT, REGR_AVGX, REGR_AVGY
+
+## References
+有关线性回归函数的更多详细信息,请参阅 SQL 标准文档中关于聚合函数的部分。
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_slope.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_slope.md
new file mode 100644
index 00000000000..295ef814cab
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_slope.md
@@ -0,0 +1,62 @@
+---
+{
+ "title": "REGR_SLOPE",
+ "language": "zh-CN"
+}
+---
+
+## Description
+REGR_SLOPE 用于计算一组数值对的最小二乘拟合线性方程的斜率。
+
+## Syntax
+```
+REGR_SLOPE(y, x)
+```
+
+## Parameters
+- `y` (数值类型):因变量。
+- `x` (数值类型):自变量。
+
+x 和 y 都支持基本数值类型。
+
+## Returned values
+返回数据类型:FLOAT64
+
+函数返回线性回归直线的斜率。
+
+如果没有行,或者只有包含空值的行,函数返回 NULL。
+
+## Examples
+```sql
+-- 示例 1:基本用法
+SELECT regr_slope(y, x) FROM test;
+
+-- 示例 2:在查询中使用示例数据
+SELECT * FROM test;
++------+------+------+
+| id | x | y |
++------+------+------+
+| 1 | 18 | 13 |
+| 3 | 12 | 2 |
+| 5 | 10 | 20 |
+| 2 | 14 | 27 |
+| 4 | 5 | 6 |
++------+------+------+
+
+SELECT regr_slope(y, x) FROM test;
++--------------------+
+| regr_slope(y, x) |
++--------------------+
+| 0.6853448275862069 |
++--------------------+
+```
+
+## Usage notes
+- 此函数会忽略任何包含空值的数值对。
+- 在计算结果会导致除以零的情况下,函数将返回 NULL。
+
+## Related functions
+REGR_INTERCEPT, REGR_R2, REGR_COUNT, REGR_AVGX, REGR_AVGY
+
+## References
+有关线性回归函数的更多详细信息,请参阅 SQL 标准文档中关于聚合函数的部分。
diff --git a/sidebars.json b/sidebars.json
index 64a9824588a..81d9020a6ef 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1570,6 +1570,8 @@
"sql-manual/sql-functions/aggregate-functions/collect-set",
"sql-manual/sql-functions/aggregate-functions/collect-list",
"sql-manual/sql-functions/aggregate-functions/retention",
+
"sql-manual/sql-functions/aggregate-functions/regr_intercept",
+
"sql-manual/sql-functions/aggregate-functions/regr_slope",
"sql-manual/sql-functions/aggregate-functions/sequence-match",
"sql-manual/sql-functions/aggregate-functions/sequence-count",
"sql-manual/sql-functions/aggregate-functions/kurt",
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
new file mode 100644
index 00000000000..e1e9d69bbd3
--- /dev/null
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_intercept.md
@@ -0,0 +1,62 @@
+---
+{
+ "title": "REGR_INTERCEPT",
+ "language": "en"
+}
+---
+
+## Description
+REGR_INTERCEPT is used to calculate the y-intercept of the least squares-fit
linear equation for a set of number pairs.
+
+## Syntax
+```
+REGR_INTERCEPT(y, x)
+```
+
+## Parameters
+- `y` (Numeric): The dependent variable.
+- `x` (Numeric): The independent variable.
+
+Both `x` and `y` support basic numeric types.
+
+## Returned values
+Returned data type: FLOAT64
+
+The function returns the y-intercept of the linear regression line.
+
+If there are no rows, or only rows with null values, the function returns NULL.
+
+## Examples
+```sql
+-- Example 1: Basic Usage
+SELECT regr_intercept(y, x) FROM test;
+
+-- Example 2: Usage in a query with sample data
+SELECT * FROM test;
++------+------+------+
+| id | x | y |
++------+------+------+
+| 1 | 18 | 13 |
+| 3 | 12 | 2 |
+| 5 | 10 | 20 |
+| 2 | 14 | 27 |
+| 4 | 5 | 6 |
++------+------+------+
+
+SELECT regr_intercept(y, x) FROM test;
++----------------------+
+| regr_intercept(y, x) |
++----------------------+
+| 5.512931034482759 |
++----------------------+
+```
+
+## Usage notes
+- This function ignores any pair where either value is null.
+- In cases where the calculation would result in a division by zero, the
function will return NULL.
+
+## Related functions
+REGR_SLOPE, REGR_R2, REGR_COUNT, REGR_AVGX, REGR_AVGY
+
+## References
+For more details about linear regression functions, please refer to the SQL
standard documentation on aggregate functions.
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_slope.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_slope.md
new file mode 100644
index 00000000000..85a090be310
--- /dev/null
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/aggregate-functions/regr_slope.md
@@ -0,0 +1,62 @@
+---
+{
+ "title": "REGR_SLOPE",
+ "language": "en"
+}
+---
+
+## Description
+REGR_SLOPE is used to calculate the slope of the least squares-fit linear
equation for a set of number pairs.
+
+## Syntax
+```
+REGR_SLOPE(y, x)
+```
+
+## Parameters
+- `y` (Numeric): The dependent variable.
+- `x` (Numeric): The independent variable.
+
+Both `x` and `y` support basic numeric types.
+
+## Returned values
+Returned data type: FLOAT64
+
+The function returns the slope of the linear regression line.
+
+If there are no rows, or only rows with null values, the function returns NULL.
+
+## Examples
+```sql
+-- Example 1: Basic Usage
+SELECT regr_slope(y, x) FROM test;
+
+-- Example 2: Usage in a query with sample data
+SELECT * FROM test;
++------+------+------+
+| id | x | y |
++------+------+------+
+| 1 | 18 | 13 |
+| 3 | 12 | 2 |
+| 5 | 10 | 20 |
+| 2 | 14 | 27 |
+| 4 | 5 | 6 |
++------+------+------+
+
+SELECT regr_slope(y, x) FROM test;
++--------------------+
+| regr_slope(y, x) |
++--------------------+
+| 0.6853448275862069 |
++--------------------+
+```
+
+## Usage notes
+- This function ignores any pair where either value is null.
+- In cases where the calculation would result in a division by zero, the
function will return NULL.
+
+## Related functions
+REGR_INTERCEPT, REGR_R2, REGR_COUNT, REGR_AVGX, REGR_AVGY
+
+## References
+For more details about linear regression functions, please refer to the SQL
standard documentation on aggregate functions.
diff --git a/versioned_sidebars/version-3.0-sidebars.json
b/versioned_sidebars/version-3.0-sidebars.json
index dc4c99495ab..552e0909b2a 100644
--- a/versioned_sidebars/version-3.0-sidebars.json
+++ b/versioned_sidebars/version-3.0-sidebars.json
@@ -1611,6 +1611,8 @@
"sql-manual/sql-functions/aggregate-functions/collect-set",
"sql-manual/sql-functions/aggregate-functions/collect-list",
"sql-manual/sql-functions/aggregate-functions/retention",
+
"sql-manual/sql-functions/aggregate-functions/regr_intercept",
+
"sql-manual/sql-functions/aggregate-functions/regr_slope",
"sql-manual/sql-functions/aggregate-functions/sequence-match",
"sql-manual/sql-functions/aggregate-functions/sequence-count",
"sql-manual/sql-functions/aggregate-functions/kurt",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]