This is an automated email from the ASF dual-hosted git repository.
zclllyybb 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 dfb02ba9713 Revert "[Fix](variance) Fix sample variance/stddev null
res for single value" (#3919)
dfb02ba9713 is described below
commit dfb02ba971358b1e71ec4c3c9326c373b93cad3f
Author: linrrarity <[email protected]>
AuthorDate: Mon Jun 8 18:53:38 2026 +0800
Revert "[Fix](variance) Fix sample variance/stddev null res for single
value" (#3919)
Reverts apache/doris-website#3765
---
.../aggregate-functions/stddev-samp.md | 33 ++--------------------
.../sql-functions/aggregate-functions/var-samp.md | 31 +-------------------
.../aggregate-functions/stddev-samp.md | 31 +-------------------
.../sql-functions/aggregate-functions/var-samp.md | 31 +-------------------
.../aggregate-functions/stddev-samp.md | 31 +-------------------
.../sql-functions/aggregate-functions/var-samp.md | 31 +-------------------
.../aggregate-functions/stddev-samp.md | 33 ++--------------------
.../sql-functions/aggregate-functions/var-samp.md | 31 +-------------------
8 files changed, 10 insertions(+), 242 deletions(-)
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
b/docs/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
index 8c03f904b2e..46c26916539 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
@@ -10,14 +10,6 @@
Returns the sample standard deviation of the expr expression
-The calculation formula is:
-
-$
-\mathrm{STDDEV\_SAMP}(x)=\sqrt{\mathrm{VAR\_SAMP}(x)}=\sqrt{\frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}}
-$
-
-Where `n` is the number of valid values in the group.
-
## Syntax
```sql
@@ -33,11 +25,11 @@ STDDEV_SAMP(<expr>)
## Return Value
Return the sample standard deviation of the expr expression as Double type.
-If there is no valid data in the group, returns NULL. If the number of valid
values in the group is 1, returns NaN.
+If there is no valid data in the group, returns NULL.
### Examples
```sql
--- Create sample table
+-- Create sample tables
CREATE TABLE score_table (
student_id INT,
score DOUBLE
@@ -66,24 +58,3 @@ FROM score_table;
| 4.949747468305831 |
+-------------------+
```
-
-When the number of valid values is 1, `STDDEV_SAMP` returns `NaN`.
-
-```sql
--- Create a single-column sample table
-CREATE TABLE sample_values (
- value INT
-) DISTRIBUTED BY HASH(value)
-PROPERTIES (
- "replication_num" = "1"
-);
-
-INSERT INTO sample_values VALUES (10);
-
-SELECT STDDEV_SAMP(value) AS sample_stddev FROM sample_values;
-+---------------+
-| sample_stddev |
-+---------------+
-| NaN |
-+---------------+
-```
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/var-samp.md
b/docs/sql-manual/sql-functions/aggregate-functions/var-samp.md
index c3e61d58796..069452376d5 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/var-samp.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/var-samp.md
@@ -10,14 +10,6 @@
The VAR_SAMP function calculates the sample variance of a specified
expression. Unlike VARIANCE (population variance), VAR_SAMP uses n-1 as the
divisor, which is considered an unbiased estimate of the population variance in
statistics.
-The calculation formula is:
-
-$
-\mathrm{VAR\_SAMP}(x)=\frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}
-$
-
-Where `n` is the number of valid values in the group.
-
## Alias
- VARIANCE_SAMP
@@ -36,7 +28,7 @@ VAR_SAMP(<expr>)
## Return Value
Returns a Double value representing the calculated sample variance.
-If there is no valid data in the group, returns NULL. If the number of valid
values in the group is 1, returns NaN.
+If there is no valid data in the group, returns NULL.
## Examples
```sql
@@ -74,24 +66,3 @@ FROM student_scores;
| 29.4107142857143 | 25.73437500000001 |
+------------------+---------------------+
```
-
-When the number of valid values is 1, `VAR_SAMP` returns `NaN`.
-
-```sql
--- Create a single-column sample table
-CREATE TABLE sample_values (
- value INT
-) DISTRIBUTED BY HASH(value)
-PROPERTIES (
- "replication_num" = "1"
-);
-
-INSERT INTO sample_values VALUES (10);
-
-SELECT VAR_SAMP(value) AS sample_variance FROM sample_values;
-+-----------------+
-| sample_variance |
-+-----------------+
-| NaN |
-+-----------------+
-```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
index 19452bac10d..c153609b66c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
@@ -10,14 +10,6 @@
返回 expr 表达式的样本标准差
-计算公式如下:
-
-$
-\mathrm{STDDEV\_SAMP}(x)=\sqrt{\mathrm{VAR\_SAMP}(x)}=\sqrt{\frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}}
-$
-
-其中 `n` 为组内合法数据的个数。
-
## 语法
```sql
@@ -33,7 +25,7 @@ STDDEV_SAMP(<expr>)
## 返回值
返回 Double 类型的参数 expr 的样本标准差。
-当组内没有合法数据时,返回 NULL。组内合法数据个数为 1 时,返回 NaN。
+当组内没有合法数据时,返回 NULL。
## 举例
```sql
@@ -66,24 +58,3 @@ FROM score_table;
| 4.949747468305831 |
+-------------------+
```
-
-当合法数据个数为 1 时,`STDDEV_SAMP` 返回 `NaN`。
-
-```sql
--- 创建单列示例表
-CREATE TABLE sample_values (
- value INT
-) DISTRIBUTED BY HASH(value)
-PROPERTIES (
- "replication_num" = "1"
-);
-
-INSERT INTO sample_values VALUES (10);
-
-SELECT STDDEV_SAMP(value) AS sample_stddev FROM sample_values;
-+---------------+
-| sample_stddev |
-+---------------+
-| NaN |
-+---------------+
-```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/var-samp.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/var-samp.md
index 611e0257767..790d42085b0 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/var-samp.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/var-samp.md
@@ -10,14 +10,6 @@
VAR_SAMP 函数计算指定表达式的样本方差。与 VARIANCE(总体方差)不同,VAR_SAMP 使用 n-1
作为除数,这在统计学上被认为是对总体方差的无偏估计。
-计算公式如下:
-
-$
-\mathrm{VAR\_SAMP}(x)=\frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}
-$
-
-其中 `n` 为组内合法数据的个数。
-
## 别名
- VARIANCE_SAMP
@@ -36,7 +28,7 @@ VAR_SAMP(<expr>)
## 返回值
返回一个 Double 类型的值,表示计算得到的样本方差。
-组内没有合法数据时,返回 NULL。组内合法数据个数为 1 时,返回 NaN。
+组内没有合法数据时,返回 NULL。
## 举例
```sql
@@ -74,24 +66,3 @@ FROM student_scores;
| 29.4107142857143 | 25.73437500000001 |
+------------------+---------------------+
```
-
-当合法数据个数为 1 时,`VAR_SAMP` 返回 `NaN`。
-
-```sql
--- 创建单列示例表
-CREATE TABLE sample_values (
- value INT
-) DISTRIBUTED BY HASH(value)
-PROPERTIES (
- "replication_num" = "1"
-);
-
-INSERT INTO sample_values VALUES (10);
-
-SELECT VAR_SAMP(value) AS sample_variance FROM sample_values;
-+-----------------+
-| sample_variance |
-+-----------------+
-| NaN |
-+-----------------+
-```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
index 19452bac10d..c153609b66c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
@@ -10,14 +10,6 @@
返回 expr 表达式的样本标准差
-计算公式如下:
-
-$
-\mathrm{STDDEV\_SAMP}(x)=\sqrt{\mathrm{VAR\_SAMP}(x)}=\sqrt{\frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}}
-$
-
-其中 `n` 为组内合法数据的个数。
-
## 语法
```sql
@@ -33,7 +25,7 @@ STDDEV_SAMP(<expr>)
## 返回值
返回 Double 类型的参数 expr 的样本标准差。
-当组内没有合法数据时,返回 NULL。组内合法数据个数为 1 时,返回 NaN。
+当组内没有合法数据时,返回 NULL。
## 举例
```sql
@@ -66,24 +58,3 @@ FROM score_table;
| 4.949747468305831 |
+-------------------+
```
-
-当合法数据个数为 1 时,`STDDEV_SAMP` 返回 `NaN`。
-
-```sql
--- 创建单列示例表
-CREATE TABLE sample_values (
- value INT
-) DISTRIBUTED BY HASH(value)
-PROPERTIES (
- "replication_num" = "1"
-);
-
-INSERT INTO sample_values VALUES (10);
-
-SELECT STDDEV_SAMP(value) AS sample_stddev FROM sample_values;
-+---------------+
-| sample_stddev |
-+---------------+
-| NaN |
-+---------------+
-```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/var-samp.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/var-samp.md
index 611e0257767..790d42085b0 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/var-samp.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/var-samp.md
@@ -10,14 +10,6 @@
VAR_SAMP 函数计算指定表达式的样本方差。与 VARIANCE(总体方差)不同,VAR_SAMP 使用 n-1
作为除数,这在统计学上被认为是对总体方差的无偏估计。
-计算公式如下:
-
-$
-\mathrm{VAR\_SAMP}(x)=\frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}
-$
-
-其中 `n` 为组内合法数据的个数。
-
## 别名
- VARIANCE_SAMP
@@ -36,7 +28,7 @@ VAR_SAMP(<expr>)
## 返回值
返回一个 Double 类型的值,表示计算得到的样本方差。
-组内没有合法数据时,返回 NULL。组内合法数据个数为 1 时,返回 NaN。
+组内没有合法数据时,返回 NULL。
## 举例
```sql
@@ -74,24 +66,3 @@ FROM student_scores;
| 29.4107142857143 | 25.73437500000001 |
+------------------+---------------------+
```
-
-当合法数据个数为 1 时,`VAR_SAMP` 返回 `NaN`。
-
-```sql
--- 创建单列示例表
-CREATE TABLE sample_values (
- value INT
-) DISTRIBUTED BY HASH(value)
-PROPERTIES (
- "replication_num" = "1"
-);
-
-INSERT INTO sample_values VALUES (10);
-
-SELECT VAR_SAMP(value) AS sample_variance FROM sample_values;
-+-----------------+
-| sample_variance |
-+-----------------+
-| NaN |
-+-----------------+
-```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
index 8c03f904b2e..46c26916539 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/stddev-samp.md
@@ -10,14 +10,6 @@
Returns the sample standard deviation of the expr expression
-The calculation formula is:
-
-$
-\mathrm{STDDEV\_SAMP}(x)=\sqrt{\mathrm{VAR\_SAMP}(x)}=\sqrt{\frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}}
-$
-
-Where `n` is the number of valid values in the group.
-
## Syntax
```sql
@@ -33,11 +25,11 @@ STDDEV_SAMP(<expr>)
## Return Value
Return the sample standard deviation of the expr expression as Double type.
-If there is no valid data in the group, returns NULL. If the number of valid
values in the group is 1, returns NaN.
+If there is no valid data in the group, returns NULL.
### Examples
```sql
--- Create sample table
+-- Create sample tables
CREATE TABLE score_table (
student_id INT,
score DOUBLE
@@ -66,24 +58,3 @@ FROM score_table;
| 4.949747468305831 |
+-------------------+
```
-
-When the number of valid values is 1, `STDDEV_SAMP` returns `NaN`.
-
-```sql
--- Create a single-column sample table
-CREATE TABLE sample_values (
- value INT
-) DISTRIBUTED BY HASH(value)
-PROPERTIES (
- "replication_num" = "1"
-);
-
-INSERT INTO sample_values VALUES (10);
-
-SELECT STDDEV_SAMP(value) AS sample_stddev FROM sample_values;
-+---------------+
-| sample_stddev |
-+---------------+
-| NaN |
-+---------------+
-```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/var-samp.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/var-samp.md
index c3e61d58796..069452376d5 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/var-samp.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/var-samp.md
@@ -10,14 +10,6 @@
The VAR_SAMP function calculates the sample variance of a specified
expression. Unlike VARIANCE (population variance), VAR_SAMP uses n-1 as the
divisor, which is considered an unbiased estimate of the population variance in
statistics.
-The calculation formula is:
-
-$
-\mathrm{VAR\_SAMP}(x)=\frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}
-$
-
-Where `n` is the number of valid values in the group.
-
## Alias
- VARIANCE_SAMP
@@ -36,7 +28,7 @@ VAR_SAMP(<expr>)
## Return Value
Returns a Double value representing the calculated sample variance.
-If there is no valid data in the group, returns NULL. If the number of valid
values in the group is 1, returns NaN.
+If there is no valid data in the group, returns NULL.
## Examples
```sql
@@ -74,24 +66,3 @@ FROM student_scores;
| 29.4107142857143 | 25.73437500000001 |
+------------------+---------------------+
```
-
-When the number of valid values is 1, `VAR_SAMP` returns `NaN`.
-
-```sql
--- Create a single-column sample table
-CREATE TABLE sample_values (
- value INT
-) DISTRIBUTED BY HASH(value)
-PROPERTIES (
- "replication_num" = "1"
-);
-
-INSERT INTO sample_values VALUES (10);
-
-SELECT VAR_SAMP(value) AS sample_variance FROM sample_values;
-+-----------------+
-| sample_variance |
-+-----------------+
-| NaN |
-+-----------------+
-```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]