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 e7415882067 [Enhancement](function) Relax the upper bound of
unix_timestamp and from_unixtime (#2759)
e7415882067 is described below
commit e7415882067ea7d5356e9b32be275cfefc81485e
Author: zclllyybb <[email protected]>
AuthorDate: Mon Aug 18 12:13:08 2025 +0800
[Enhancement](function) Relax the upper bound of unix_timestamp and
from_unixtime (#2759)
doc of https://github.com/apache/doris/pull/53742
## Versions
- [x] dev
- [x] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../date-time-functions/from-unixtime.md | 14 +++++++++++--
.../date-time-functions/unix-timestamp.md | 18 ++++++++--------
.../date-time-functions/from-unixtime.md | 14 +++++++++++--
.../date-time-functions/unix-timestamp.md | 20 ++++++++----------
.../date-time-functions/from-unixtime.md | 22 +++++++++++++++++++-
.../date-time-functions/unix-timestamp.md | 21 ++++++++++++++++++-
.../date-time-functions/from-unixtime.md | 22 +++++++++++++++++++-
.../date-time-functions/unix-timestamp.md | 24 +++++++++++++++++++---
8 files changed, 125 insertions(+), 30 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
index 657de4917c6..f2a9f98ae85 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
@@ -7,9 +7,11 @@
## Description
-Converts a Unix timestamp to the corresponding TIME format. Special cases:
+Converts a Unix timestamp to the corresponding TIME format.
-- The currently supported range for unix_timestamp is [0, 32536771199]. Unix
timestamps outside this range will return NULL.
+Special cases:
+
+- Supported input range for `unix_timestamp` is `[0, 253402271999.999999]`.
Values outside this range return `NULL`.
## Syntax
@@ -45,6 +47,14 @@ mysql> select from_unixtime(1196440219, 'yyyy-MM-dd
HH:mm:ss');
| 2007-12-01 00:30:19 |
+--------------------------------------------------+
+-- Maximum supported time
+mysql> select from_unixtime(253402271999.999999);
++------------------------------------+
+| from_unixtime(253402271999.999999) |
++------------------------------------+
+| 9999-12-31 23:59:59.999999 |
++------------------------------------+
+
mysql> select from_unixtime(1196440219, '%Y-%m-%d');
+-----------------------------------------+
| from_unixtime(1196440219, '%Y-%m-%d') |
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
index 0a14a0eff60..ff598723cbc 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
@@ -28,7 +28,7 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
| Paramters | Description |
| -- | -- |
-| `<date>` | The datetime value to be converted is of type `datetime` or
`date` type, with a convertible range from '1970-01-01 00:00:01.000000 UTC' to
'3001-01-19 03:14:07.999999 UTC'.|
+| `<date>` | The datetime value to be converted is of type `datetime` or
`date` type, supported range: '1970-01-01 00:00:00.000000 UTC' to '9999-12-31
23:59:59.999999 UTC'.|
| `<fmt>` | The 'date' parameter refers to the specific part that needs to be
converted into a timestamp, and it is a parameter of type string. If this
parameter is provided, only the part matching the format will be converted into
a timestamp. |
## Return value
@@ -39,7 +39,7 @@ returns a timestamp of type Decimal with a maximum precision
of six decimal plac
- If the input datetime scale is 0 and no format parameter is provided,
returns a timestamp of type INT.
-- For times before '1970-01-01 00:00:01.000000 UTC' or after '3001-01-19
03:14:07.999999 UTC', the function returns 0.
+- Supported input range is from '1970-01-01 00:00:00.000000 UTC' to
'9999-12-31 23:59:59.999999 UTC'. Times earlier than the minimum return 0.
Returns NULL if any argument is NULL.
@@ -111,14 +111,14 @@ mysql> SELECT UNIX_TIMESTAMP('2015-11-13 10:20:19.123');
| 1447381219.123 |
+-------------------------------------------+
----Exceeding the maximum allowed time range
+---Maximum supported time
-mysql> SELECT UNIX_TIMESTAMP('3001-01-19 03:14:07.999999');
-+----------------------------------------------+
-| UNIX_TIMESTAMP('3001-01-19 03:14:07.999999') |
-+----------------------------------------------+
-| 0.000000 |
-+----------------------------------------------+
+mysql> SELECT UNIX_TIMESTAMP('9999-12-31 23:59:59.999999');
++--------------------------------------------------+
+| UNIX_TIMESTAMP('9999-12-31 23:59:59.999999') |
++--------------------------------------------------+
+| 253402271999.999999|
++--------------------------------------------------+
---Returns NULL if any argument is NULL
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
index 5cff0a56f63..4bfdaf4b896 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
@@ -7,8 +7,10 @@
## 描述
-将 unix 时间戳转化为对应的 time 格式。特殊情况:
-- 目前支持的 `unix_timestamp` 范围为 `[0, 32536771199]`,超出范围的 `unix_timestamp` 将会得到
NULL
+将 unix 时间戳转化为对应的 time 格式。
+
+特殊情况:
+- 支持的 `unix_timestamp` 输入范围为 `[0, 253402271999.999999]`,超出范围的值将返回 `NULL`。
## 语法
@@ -44,6 +46,14 @@ mysql> select from_unixtime(1196440219, 'yyyy-MM-dd
HH:mm:ss');
| 2007-12-01 00:30:19 |
+--------------------------------------------------+
+-- 最大支持时间
+mysql> select from_unixtime(253402271999.999999);
++------------------------------------+
+| from_unixtime(253402271999.999999) |
++------------------------------------+
+| 9999-12-31 23:59:59.999999 |
++------------------------------------+
+
mysql> select from_unixtime(1196440219, '%Y-%m-%d');
+-----------------------------------------+
| from_unixtime(1196440219, '%Y-%m-%d') |
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
index 7b9ae167d7e..bd6bd8da290 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
@@ -28,7 +28,7 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
| 参数 | 描述 |
| -- | -- |
-| `<date>` | 待转换的日期时间值,类型为 `datetime` 或 `date` 类型,可转换范围为 '1970-01-01
00:00:01.000000 UTC' 至 '3001-01-19 03:14:07.999999 UTC'。|
+| `<date>` | 待转换的日期时间值,类型为 `datetime` 或 `date` 类型,支持范围:'1970-01-01
00:00:00.000000 UTC' 至 '9999-12-31 23:59:59.999999 UTC'。|
| `<fmt>` | date 参数指代需要转换为时间戳的特定部分,其类型为 `string`。若提供该参数,则仅将与格式匹配的部分转换为时间戳。 |
## 返回值
@@ -40,7 +40,7 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
2.若是输入的 `date` scale 为 0 并且不带有 `format` 参数
返回一个时间戳,类型为 INT
-对于在 1970-01-01 00:00:01.000000 UTC 之前或 3001-01-19 03:14:07.999999 UTC
之后的时间,该函数将返回 0。
+支持的输入范围为 '1970-01-01 00:00:00.000000 UTC' 至 '9999-12-31 23:59:59.999999
UTC'。早于最小值的时间返回 0。
任意参数为 null 则返回 null
@@ -111,15 +111,14 @@ mysql> SELECT UNIX_TIMESTAMP('2015-11-13 10:20:19.123');
| 1447381219.123 |
+-------------------------------------------+
----超过允许时间的最大范围
-
-mysql> SELECT UNIX_TIMESTAMP('3001-01-19 03:14:07.999999');
-+----------------------------------------------+
-| UNIX_TIMESTAMP('3001-01-19 03:14:07.999999') |
-+----------------------------------------------+
-| 0.000000 |
-+----------------------------------------------+
+---最大支持时间
+mysql> SELECT UNIX_TIMESTAMP('9999-12-31 23:59:59.999999');
++--------------------------------------------------+
+| UNIX_TIMESTAMP('9999-12-31 23:59:59.999999') |
++--------------------------------------------------+
+| 253402271999.999999|
++--------------------------------------------------+
---任意参数为 null 则返回 Null
mysql> select unix_timestamp(NULL);
@@ -135,7 +134,6 @@ mysql> select unix_timestamp('2038-01-19 11:14:08',null);
+--------------------------------------------+
| NULL |
+--------------------------------------------+
-
```
### keywords
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
index 5cff0a56f63..a4cedb87f41 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
@@ -7,6 +7,12 @@
## 描述
+将 unix 时间戳转化为对应的 time 格式。
+
+:::note
+自 3.0.8 与 3.1.0 起,`unix_timestamp` 的输入范围为 `[0, 253402271999.999999]`,超出范围的值将返回
`NULL`。
+:::
+
将 unix 时间戳转化为对应的 time 格式。特殊情况:
- 目前支持的 `unix_timestamp` 范围为 `[0, 32536771199]`,超出范围的 `unix_timestamp` 将会得到
NULL
@@ -57,4 +63,18 @@ mysql> select from_unixtime(1196440219, '%Y-%m-%d %H:%i:%s');
+--------------------------------------------------+
| 2007-12-01 00:30:19 |
+--------------------------------------------------+
-```
\ No newline at end of file
+```
+
+### 新行为示例(自 3.0.8 与 3.1.0 起)
+
+以下示例展示了 3.0.8/3.1.0 及之后版本扩展后的上限。在此之前,相同输入会返回 NULL。
+
+```sql
+-- 3.0.8/3.1.0+ 的最大支持时间
+mysql> select from_unixtime(253402271999.999999);
++------------------------------------+
+| from_unixtime(253402271999.999999) |
++------------------------------------+
+| 9999-12-31 23:59:59.999999 |
++------------------------------------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
index 7b9ae167d7e..979e1ddd1e0 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
@@ -17,6 +17,11 @@ Format 的格式请参阅 `date_format` 函数的格式说明。
该函数受时区影响。
+:::note
+自 3.0.8 与 3.1.0 起,时间上限扩展至 `9999-12-31 23:59:59.999999`。
+:::
+
+
## 语法
```sql
@@ -40,7 +45,7 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
2.若是输入的 `date` scale 为 0 并且不带有 `format` 参数
返回一个时间戳,类型为 INT
-对于在 1970-01-01 00:00:01.000000 UTC 之前或 3001-01-19 03:14:07.999999 UTC
之后的时间,该函数将返回 0。
+支持的输入范围为 '1970-01-01 00:00:01.000000 UTC' 至 '3001-01-19 03:14:07.999999
UTC'。早于最小值的时间返回 0;超过最大值的时间返回 0。
任意参数为 null 则返回 null
@@ -138,6 +143,20 @@ mysql> select unix_timestamp('2038-01-19 11:14:08',null);
```
+### 新行为示例(自 3.0.8 与 3.1.0 起)
+
+以下示例展示了 3.0.8/3.1.0 及之后版本扩展后的上限。在此之前,相同输入会返回 0。
+
+```sql
+-- 3.0.8/3.1.0+ 的最大支持时间
+mysql> SELECT UNIX_TIMESTAMP('9999-12-31 23:59:59.999999');
++--------------------------------------------------+
+| UNIX_TIMESTAMP('9999-12-31 23:59:59.999999') |
++--------------------------------------------------+
+| 253402271999.999999|
++--------------------------------------------------+
+```
+
### keywords
UNIX_TIMESTAMP,UNIX,TIMESTAMP
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
index 657de4917c6..429f90f19bc 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime.md
@@ -7,6 +7,12 @@
## Description
+Converts a Unix timestamp to the corresponding TIME format.
+
+:::note
+Since 3.0.8 and 3.1.0, the supported input range for `unix_timestamp` is `[0,
253402271999.999999]`. Values outside this range return `NULL`.
+:::
+
Converts a Unix timestamp to the corresponding TIME format. Special cases:
- The currently supported range for unix_timestamp is [0, 32536771199]. Unix
timestamps outside this range will return NULL.
@@ -58,4 +64,18 @@ mysql> select from_unixtime(1196440219, '%Y-%m-%d %H:%i:%s');
+--------------------------------------------------+
| 2007-12-01 00:30:19 |
+--------------------------------------------------+
-```
\ No newline at end of file
+```
+
+### New behavior examples (since 3.0.8/3.1.0)
+
+The following example shows the extended upper bound available in 3.0.8/3.1.0
and later. Prior to these versions, the same input would return NULL.
+
+```sql
+-- Maximum supported timestamp in 3.0.8/3.1.0+
+mysql> select from_unixtime(253402271999.999999);
++------------------------------------+
+| from_unixtime(253402271999.999999) |
++------------------------------------+
+| 9999-12-31 23:59:59.999999 |
++------------------------------------+
+```
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
index 0a14a0eff60..072a082b2d3 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md
@@ -17,6 +17,10 @@ For the format specification, refer to the format
description of the date_format
This function is affected by the time zone.
+:::note
+Since 3.0.8 and 3.1.0, the maximum supported time is extended to `9999-12-31
23:59:59.999999`.
+:::
+
## Sytax
```sql
@@ -28,7 +32,7 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
| Paramters | Description |
| -- | -- |
-| `<date>` | The datetime value to be converted is of type `datetime` or
`date` type, with a convertible range from '1970-01-01 00:00:01.000000 UTC' to
'3001-01-19 03:14:07.999999 UTC'.|
+| `<date>` | The datetime value to be converted is of type `datetime` or
`date` type, convertible range: '1970-01-01 00:00:01.000000 UTC' to '3001-01-19
03:14:07.999999 UTC'.|
| `<fmt>` | The 'date' parameter refers to the specific part that needs to be
converted into a timestamp, and it is a parameter of type string. If this
parameter is provided, only the part matching the format will be converted into
a timestamp. |
## Return value
@@ -39,7 +43,7 @@ returns a timestamp of type Decimal with a maximum precision
of six decimal plac
- If the input datetime scale is 0 and no format parameter is provided,
returns a timestamp of type INT.
-- For times before '1970-01-01 00:00:01.000000 UTC' or after '3001-01-19
03:14:07.999999 UTC', the function returns 0.
+- Supported input range is from '1970-01-01 00:00:01.000000 UTC' to
'3001-01-19 03:14:07.999999 UTC'. Times earlier than the minimum return 0;
times after the maximum return 0.
Returns NULL if any argument is NULL.
@@ -111,7 +115,7 @@ mysql> SELECT UNIX_TIMESTAMP('2015-11-13 10:20:19.123');
| 1447381219.123 |
+-------------------------------------------+
----Exceeding the maximum allowed time range
+---Exceeding the maximum allowed range
mysql> SELECT UNIX_TIMESTAMP('3001-01-19 03:14:07.999999');
+----------------------------------------------+
@@ -138,6 +142,20 @@ mysql> select unix_timestamp('2038-01-19 11:14:08',null);
```
+### New behavior examples (since 3.0.8 and 3.1.0)
+
+The following examples illustrate the extended upper bound available in 3.0.8
and 3.1.0 and later. Prior to these versions, such inputs would return 0.
+
+```sql
+-- Maximum supported time in 3.0.8/3.1.0+
+mysql> SELECT UNIX_TIMESTAMP('9999-12-31 23:59:59.999999');
++--------------------------------------------------+
+| UNIX_TIMESTAMP('9999-12-31 23:59:59.999999') |
++--------------------------------------------------+
+| 253402271999.999999|
++--------------------------------------------------+
+```
+
### keywords
UNIX_TIMESTAMP,UNIX,TIMESTAMP
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]