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 f88a8b5fd90 [doc] Add a range limit to the second parameter of
format_round. (#2873)
f88a8b5fd90 is described below
commit f88a8b5fd90283253614053a8364882d85c1ccac
Author: Mryange <[email protected]>
AuthorDate: Sat Sep 13 17:37:20 2025 +0800
[doc] Add a range limit to the second parameter of format_round. (#2873)
## Versions
- [x] dev
- [x] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../scalar-functions/numeric-functions/format-round.md | 12 ++++++++++--
.../scalar-functions/numeric-functions/format-round.md | 13 +++++++++----
.../scalar-functions/numeric-functions/format-round.md | 13 +++++++++----
.../scalar-functions/numeric-functions/format-round.md | 12 ++++++++++--
4 files changed, 38 insertions(+), 12 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
index 25e06bcf788..8ac0afda6d9 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
@@ -24,7 +24,7 @@ FORMAT_ROUND(<number>, <D>)
| Parameter | Description |
| -- | -- |
| `<number>` | The number to be formatted |
-| `<D>` | Number of decimal places |
+| `<D>` | Number of decimal places, range [0, 1024] |
## Return Value
@@ -32,6 +32,7 @@ Returns the formatted string. Special cases:
- Returns NULL when the parameter is NULL
- If D is 0, the result will have no decimal point or decimal part.
+- If D is not in [0, 1024], an error is returned indicating the argument
should be within this range.
## Examples
@@ -105,4 +106,11 @@ mysql> select format_round(123456.123456, 6);
+--------------------------------+
| 123,456.123456 |
+--------------------------------+
-```
+```
+
+```sql
+mysql> SELECT format_round(-0.01, -1);
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]The second argument is -1, it should be in range
[0, 1024].
+mysql> SELECT format_round(-0.01, -1500);
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]The second argument is -1500, it should be in
range [0, 1024].
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
index e2bdc372f13..52fbd06e9a7 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
@@ -24,7 +24,7 @@ FORMAT_ROUND(<number>, <D>)
| 参数 | 说明 |
| -- | -- |
| `<number>` | 需要被格式化的数字 |
-| `<D>` | 小数位数 |
+| `<D>` | 小数位数,范围 [0, 1024] |
## 返回值
@@ -32,6 +32,7 @@ FORMAT_ROUND(<number>, <D>)
- 当参数为 NULL 时,返回 NULL
- 如果 D 为 0,结果将没有小数点或小数部分。
+- 如果 D 不在 [0, 1024] 范围内,将返回错误提示参数应在该范围内。
## 举例
@@ -62,8 +63,6 @@ mysql> select format_round(1123.4, 2);
+-------------------------+
```
-
-
```sql
mysql> select format_round(123456, 0);
+-------------------------+
@@ -82,7 +81,6 @@ mysql> select format_round(123456, 3);
+-------------------------+
```
-
```sql
mysql> select format_round(123456.123456, 0);
+--------------------------------+
@@ -109,3 +107,10 @@ mysql> select format_round(123456.123456, 6);
| 123,456.123456 |
+--------------------------------+
```
+
+```sql
+mysql> SELECT format_round(-0.01, -1);
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]The second argument is -1, it should be in range
[0, 1024].
+mysql> SELECT format_round(-0.01, -1500);
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]The second argument is -1500, it should be in
range [0, 1024].
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
index e2bdc372f13..52fbd06e9a7 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
@@ -24,7 +24,7 @@ FORMAT_ROUND(<number>, <D>)
| 参数 | 说明 |
| -- | -- |
| `<number>` | 需要被格式化的数字 |
-| `<D>` | 小数位数 |
+| `<D>` | 小数位数,范围 [0, 1024] |
## 返回值
@@ -32,6 +32,7 @@ FORMAT_ROUND(<number>, <D>)
- 当参数为 NULL 时,返回 NULL
- 如果 D 为 0,结果将没有小数点或小数部分。
+- 如果 D 不在 [0, 1024] 范围内,将返回错误提示参数应在该范围内。
## 举例
@@ -62,8 +63,6 @@ mysql> select format_round(1123.4, 2);
+-------------------------+
```
-
-
```sql
mysql> select format_round(123456, 0);
+-------------------------+
@@ -82,7 +81,6 @@ mysql> select format_round(123456, 3);
+-------------------------+
```
-
```sql
mysql> select format_round(123456.123456, 0);
+--------------------------------+
@@ -109,3 +107,10 @@ mysql> select format_round(123456.123456, 6);
| 123,456.123456 |
+--------------------------------+
```
+
+```sql
+mysql> SELECT format_round(-0.01, -1);
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]The second argument is -1, it should be in range
[0, 1024].
+mysql> SELECT format_round(-0.01, -1500);
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]The second argument is -1500, it should be in
range [0, 1024].
+```
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
index 25e06bcf788..8ac0afda6d9 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/format-round.md
@@ -24,7 +24,7 @@ FORMAT_ROUND(<number>, <D>)
| Parameter | Description |
| -- | -- |
| `<number>` | The number to be formatted |
-| `<D>` | Number of decimal places |
+| `<D>` | Number of decimal places, range [0, 1024] |
## Return Value
@@ -32,6 +32,7 @@ Returns the formatted string. Special cases:
- Returns NULL when the parameter is NULL
- If D is 0, the result will have no decimal point or decimal part.
+- If D is not in [0, 1024], an error is returned indicating the argument
should be within this range.
## Examples
@@ -105,4 +106,11 @@ mysql> select format_round(123456.123456, 6);
+--------------------------------+
| 123,456.123456 |
+--------------------------------+
-```
+```
+
+```sql
+mysql> SELECT format_round(-0.01, -1);
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]The second argument is -1, it should be in range
[0, 1024].
+mysql> SELECT format_round(-0.01, -1500);
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]The second argument is -1500, it should be in
range [0, 1024].
+```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]