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 7cf87c4d855 [doc](agg) add doc for sem (#3042)
7cf87c4d855 is described below
commit 7cf87c4d85534ac0a8318d61406bcef450ec7446
Author: admiring_xm <[email protected]>
AuthorDate: Wed Nov 5 14:27:27 2025 +0800
[doc](agg) add doc for sem (#3042)
## Versions
- [x] dev
- [ ] 3.x
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../sql-functions/aggregate-functions/sem.md | 105 +++++++++++++++++++++
.../sql-functions/aggregate-functions/sem.md | 105 +++++++++++++++++++++
sidebars.json | 1 +
3 files changed, 211 insertions(+)
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/sem.md
b/docs/sql-manual/sql-functions/aggregate-functions/sem.md
new file mode 100644
index 00000000000..1053065f353
--- /dev/null
+++ b/docs/sql-manual/sql-functions/aggregate-functions/sem.md
@@ -0,0 +1,105 @@
+---
+{
+"title": "SEM",
+"language": "en"
+}
+---
+
+## Description
+
+Calculate the standard error of the mean for all non-null values in the
specified column or expression.
+
+Let the sample value be $x_i$, the sample size be $n$, and the sample mean be
$\bar{x}$:
+
+$
+\mathrm{SEM}=\sqrt{\frac{1}{n(n-1)}\sum_{i=1}^{n}\bigl(x_i-\bar{x}\bigr)^2}.
+$
+
+## Syntax
+
+```text
+SEM([DISTINCT] <expr>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<expr>` | An expression or column, typically a numeric column or an
expression that can be converted to a numeric value, supporting the Double data
type.|
+| `[DISTINCT]` | An optional keyword indicating that the mean standard error
should be calculated after removing duplicate values in expr.。 |
+
+## Return Value
+
+Returns a Double. Returns the standard error of the mean for the selected
column or expression. If all records within the group are NULL, the function
returns NULL.
+
+## Examples
+
+```sql
+-- setup
+create table t1(
+ id int,
+ k_double double,
+) distributed by hash (id) buckets 1
+properties ("replication_num"="1");
+insert into t1 values
+ (1, 222.222),
+ (2, 3.3),
+ (3, 3.3),
+ (4, null);
+```
+
+```sql
+select sem(k_double) from t1;
+```
+
+Calculation of the Mean Standard Error for Double Type: The standard error of
the mean for [222.222, 3.3, 3.3, null] is 72.974
+
+```text
++---------------+
+| sem(k_double) |
++---------------+
+| 72.974 |
++---------------+
+```
+
+```sql
+select sem(id) from t1
+```
+
+Calculation of the standard error of the mean for an int type: the standard
error of the mean for [1, 2, 3, 4] is 0.645497.
+
+```text
++--------------------+
+| sem(id) |
++--------------------+
+| 0.6454972243679028 |
++--------------------+
+```
+
+```sql
+select sem(cast(null as double)) from t1;
+```
+
+When all values are null, return null.
+
+```text
++---------------------------+
+| sem(cast(null as double)) |
++---------------------------+
+| NULL |
++---------------------------+
+```
+
+```sql
+select sem(distinct k_double) from t1;
+```
+
+Using the DISTINCT keyword for deduplication calculations, the mean standard
error after removing duplicates [222.222, 3.3, 3.3, null] is 109.461.
+
+```text
++------------------------+
+| sem(distinct k_double) |
++------------------------+
+| 109.461 |
++------------------------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/sem.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/sem.md
new file mode 100644
index 00000000000..19eb89f59b5
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/sem.md
@@ -0,0 +1,105 @@
+---
+{
+"title": "SEM",
+"language": "zh-CN"
+}
+---
+
+## 描述
+
+计算指定列或表达式的所有非 NULL 值的均值标准误。
+
+假设样本值为 $x_i$, 样本量为 $n$,样本均值为 $\bar{x}$:
+
+$
+\mathrm{SEM}=\sqrt{\frac{1}{n(n-1)}\sum_{i=1}^{n}\bigl(x_i-\bar{x}\bigr)^2}.
+$
+
+## 语法
+
+```sql
+SEM([DISTINCT] <expr>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| -- | -- |
+| `<expr>` | 是一个表达式或列,通常是一个数值列或者能够转换为数值的表达式,支持类型为 Double。|
+| `[DISTINCT]` | 是一个可选的关键字,表示对 expr 中的重复值进行去重后再计算均值标准误。 |
+
+## 返回值
+
+返回值为 Double。 返回所选列或表达式的均值标准误,如果组内的所有记录均为 NULL,则该函数返回 NULL 。
+
+## 举例
+
+```sql
+-- setup
+create table t1(
+ id int,
+ k_double double,
+) distributed by hash (id) buckets 1
+properties ("replication_num"="1");
+insert into t1 values
+ (1, 222.222),
+ (2, 3.3),
+ (3, 3.3),
+ (4, null);
+```
+
+```sql
+select sem(k_double) from t1;
+```
+
+Double 类型的均值标准误计算,[222.222,3.3,3.3,null]的均值标准误为72.974。
+
+```text
++---------------+
+| sem(k_double) |
++---------------+
+| 72.974 |
++---------------+
+```
+
+```sql
+select sem(id) from t1
+```
+
+Int 类型的均值标准误计算,[1,2,3,4]的均值标准误为0.645497。
+
+```text
++--------------------+
+| sem(id) |
++--------------------+
+| 0.6454972243679028 |
++--------------------+
+```
+
+```sql
+select sem(cast(null as double)) from t1;
+```
+
+值全为null时,返回null。
+
+```text
++---------------------------+
+| sem(cast(null as double)) |
++---------------------------+
+| NULL |
++---------------------------+
+```
+
+```sql
+select sem(distinct k_double) from t1;
+```
+
+使用 DISTINCT 关键字进行去重计算,[222.222,3.3,3.3,null]去重后均值标准误为109.461。
+
+```text
++------------------------+
+| sem(distinct k_double) |
++------------------------+
+| 109.461 |
++------------------------+
+```
diff --git a/sidebars.json b/sidebars.json
index 5a81cb14a08..b9b8936fac7 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1854,6 +1854,7 @@
"sql-manual/sql-functions/aggregate-functions/regr-intercept",
"sql-manual/sql-functions/aggregate-functions/regr-slope",
"sql-manual/sql-functions/aggregate-functions/retention",
+
"sql-manual/sql-functions/aggregate-functions/sem",
"sql-manual/sql-functions/aggregate-functions/sequence-count",
"sql-manual/sql-functions/aggregate-functions/sequence-match",
"sql-manual/sql-functions/aggregate-functions/skew",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]