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 2a5810af022 [Feature](func) Support function maketime (#3002)
2a5810af022 is described below
commit 2a5810af0225fd66059fdcdedf4bae9903efdd38
Author: linrrarity <[email protected]>
AuthorDate: Fri Oct 31 18:25:57 2025 +0800
[Feature](func) Support function maketime (#3002)
## Versions
- [x] dev
- [ ] 3.x
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../date-time-functions/maketime.md | 99 ++++++++++++++++++++++
.../date-time-functions/maketime.md | 98 +++++++++++++++++++++
sidebars.json | 1 +
3 files changed, 198 insertions(+)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/maketime.md
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/maketime.md
new file mode 100644
index 00000000000..0f31d560b6c
--- /dev/null
+++
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/maketime.md
@@ -0,0 +1,99 @@
+---
+{
+ "title": "MAKETIME",
+ "language": "en"
+}
+---
+
+## Description
+
+Returns a time value composed from the `hour`, `minute`, and `second`
arguments.
+
+This function behaves consistently with the [MAKETIME
function](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_maketime)
in MySQL.
+
+## Syntax
+
+```sql
+MAKETIME(`<hour>`, `<minute>`, `<second>`)
+```
+
+## Parameters
+
+| Parameter | Description
|
+| --------- |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
+| `hour` | The hour part of the time, supports integer type (BIGINT). The
value range is limited to [-838, 838]. If the input value exceeds this range,
it is automatically corrected to the nearest boundary value.
|
+| `minute` | The minute part of the time, supports integer type (BIGINT). The
allowed value range is [0, 59].
|
+| `second` | The second part of the time, supports integer type (BIGINT) and
float type (DOUBLE). The allowed value range is [0, 60). It supports up to six
decimal places of precision. If more than six decimal places are provided, it
will be automatically rounded. |
+
+## Return Value
+
+Returns a value of type TIME, in the format `hour:minute:second`. When the
input `seconde` is of integer type, the output value precision is 0, and when
it is of decimal type, the output value precision is the maximum precision of 6.
+
+- If `minute` or `second` exceeds the allowed range, it returns NULL.
+- If any parameter is NULL, it returns NULL.
+
+## Example
+
+```sql
+SELECT `hour`, `minute`, `sec`, MAKETIME(`hour`, `minute`, `sec`) AS ans FROM
`test_maketime`;
+```
+```text
++------+-------+--------+---------+-------------------+
+| id | hour | minute | sec | ans |
++------+-------+--------+---------+-------------------+
+| 1 | 12 | 15 | 30 | 12:15:30.000000 |
+| 2 | 14 | 56 | 12.5789 | 14:56:12.578900 |
+| 3 | 1234 | 11 | 4 | 838:59:59.000000 |
+| 4 | -1234 | 6 | 52 | -838:59:59.000000 |
+| 5 | 20 | 60 | 12 | NULL |
+| 6 | 14 | 51 | 66 | NULL |
+| 7 | NULL | 15 | 16 | NULL |
+| 8 | 7 | NULL | 8 | NULL |
+| 9 | 1 | 2 | NULL | NULL |
+| 10 | 23 | -40 | 12 | NULL |
+| 11 | 20 | 6 | -12 | NULL |
++------+-------+--------+---------+-------------------+
+```
+> Note:
+
+> 1. The `sec` column type is Float, so all output formats are time values
with six decimal places.
+> 2. 1 - 2 are normal examples.
+> 3. 3 - 4 are examples of hour overflow situations (*return fixed boundary
values*).
+> 4. 5 - 6 are examples where the minute parameter and sec parameter exceed
the reasonable range in the positive interval (*return NULL*).
+> 5. 7 - 9 are examples where any parameter is NULL (*return NULL*).
+> 6. 10 - 11 are examples where minute and sec are negative (*even if the
absolute values are reasonable, return NULL*).
+
+```sql
+SELECT `id`, `hour`, `minute`, MAKETIME(`hour`, `minute`, 27) AS ans FROM
`test_maketime`;
+```
+```text
++------+-------+--------+------------+
+| id | hour | minute | ans |
++------+-------+--------+------------+
+| 1 | 12 | 15 | 12:15:27 |
+| 2 | 14 | 56 | 14:56:27 |
+| 3 | 1234 | 11 | 838:59:59 |
+| 4 | -1234 | 6 | -838:59:59 |
+| 5 | 20 | 60 | NULL |
+| 6 | 14 | 51 | 14:51:27 |
+| 7 | NULL | 15 | NULL |
+| 8 | 7 | NULL | NULL |
+| 9 | 1 | 2 | 01:02:27 |
+| 10 | 23 | -40 | NULL |
+| 11 | 20 | 6 | 20:06:27 |
++------+-------+--------+------------+
+```
+> Note:
+> The input type of `sec` is an integer type, so the output type is all time
types without microseconds.
+
+```sql
+-- the precision of second will be rounded to six decimal places if it exceeds
six digits
+SELECT MAKETIME(12, 7, 56.1234567);
+```
+```text
++-----------------------------+
+| MAKETIME(12, 7, 56.1234567) |
++-----------------------------+
+| 12:07:56.123457 |
++-----------------------------+
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/maketime.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/maketime.md
new file mode 100644
index 00000000000..ba1657a0785
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/maketime.md
@@ -0,0 +1,98 @@
+---
+{
+ "title": "MAKETIME",
+ "language": "zh-CN"
+}
+---
+
+## 描述
+
+返回根据`hour`, `minute`, `second`组合出的时间值
+
+该函数与 mysql 中的 [makedate
函数](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_maketime)
行为一致。
+
+## 语法
+
+```sql
+MAKETIME(`<hour>`, `<minute>`, `<second>`)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ---- | ---- |
+| `hour` | 时间的小时部分,支持整数类型(BIGINT)。取值范围被限制在 [-838, 838],
若输入值超过该范围,则自动修正为最接近的边界值。 |
+| `minute` | 时间的分钟部分,支持整数类型(BITINT)。允许的取值范围为 [0, 59]。 |
+| `second` | 时间的秒数部分,支持整数(BIGINT)和小数类型(DOUBLE)。允许的取值范围为 [0, 60),
支持小数点后六位精度,若超过六位,会自动进行四舍五入。 |
+
+## 返回值
+
+返回一个TIME 类型的值,格式为 `hour:minute:second`。当输入的`seconde`为整数类型,输出值精度为
0,当其为小数类型时,输出值精度为最大精度 6。
+
+- 若`minute` 或 `second` 超过允许范围,返回 NULL
+- 任一参数为 NULL,返回 NULL
+
+## 举例
+
+```sql
+SELECT `hour`, `minute`, `sec`, MAKETIME(`hour`, `minute`, `sec`) AS ans FROM
`test_maketime`;
+```
+```text
++------+-------+--------+---------+-------------------+
+| id | hour | minute | sec | ans |
++------+-------+--------+---------+-------------------+
+| 1 | 12 | 15 | 30 | 12:15:30.000000 |
+| 2 | 14 | 56 | 12.5789 | 14:56:12.578900 |
+| 3 | 1234 | 11 | 4 | 838:59:59.000000 |
+| 4 | -1234 | 6 | 52 | -838:59:59.000000 |
+| 5 | 20 | 60 | 12 | NULL |
+| 6 | 14 | 51 | 66 | NULL |
+| 7 | NULL | 15 | 16 | NULL |
+| 8 | 7 | NULL | 8 | NULL |
+| 9 | 1 | 2 | NULL | NULL |
+| 10 | 23 | -40 | 12 | NULL |
+| 11 | 20 | 6 | -12 | NULL |
++------+-------+--------+---------+-------------------+
+```
+> 注:
+> 1. `sec` 列类型为 Float,所以输出格式全部为六位精度的时间值
+> 2. 1 - 2 为正常样例。
+> 3. 3 - 4 为 hour 越界情况样例(*返回固定边界值*)。
+> 4. 5 - 6 分别为 minute 参数和 sec 参数在正数区间超出合理范围的样例(*返回 NULL*)。
+> 5. 7 - 9 为任一参数为 NULL 的样例(*返回 NULL*)。
+> 6. 10 - 11 为 minute 和 sec 为负值的样例(*即使绝对值合理也返回 NULL*)
+
+```sql
+SELECT `id`, `hour`, `minute`, MAKETIME(`hour`, `minute`, 27) AS ans FROM
`test_maketime`;
+```
+```text
++------+-------+--------+------------+
+| id | hour | minute | ans |
++------+-------+--------+------------+
+| 1 | 12 | 15 | 12:15:27 |
+| 2 | 14 | 56 | 14:56:27 |
+| 3 | 1234 | 11 | 838:59:59 |
+| 4 | -1234 | 6 | -838:59:59 |
+| 5 | 20 | 60 | NULL |
+| 6 | 14 | 51 | 14:51:27 |
+| 7 | NULL | 15 | NULL |
+| 8 | 7 | NULL | NULL |
+| 9 | 1 | 2 | 01:02:27 |
+| 10 | 23 | -40 | NULL |
+| 11 | 20 | 6 | 20:06:27 |
++------+-------+--------+------------+
+```
+> 注:
+> `sec` 的输入类型为正数类型,故输出类型均为不带微秒的时间类型
+
+```sql
+-- second的精度超过六位会四舍五入取六位精度
+SELECT MAKETIME(12, 7, 56.1234567);
+```
+```text
++-----------------------------+
+| MAKETIME(12, 7, 56.1234567) |
++-----------------------------+
+| 12:07:56.123457 |
++-----------------------------+
+```
\ No newline at end of file
diff --git a/sidebars.json b/sidebars.json
index f30e9870c97..042e024b66e 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1398,6 +1398,7 @@
"sql-manual/sql-functions/scalar-functions/date-time-functions/hours-sub",
"sql-manual/sql-functions/scalar-functions/date-time-functions/last-day",
"sql-manual/sql-functions/scalar-functions/date-time-functions/makedate",
+
"sql-manual/sql-functions/scalar-functions/date-time-functions/maketime",
"sql-manual/sql-functions/scalar-functions/date-time-functions/microsecond",
"sql-manual/sql-functions/scalar-functions/date-time-functions/microsecond-timestamp",
"sql-manual/sql-functions/scalar-functions/date-time-functions/microseconds-add",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]