This is an automated email from the ASF dual-hosted git repository.

morningman 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 477de354dd1c [docs](3.x) Clarify DATE_TRUNC argument-order 
availability (#4619)
477de354dd1c is described below

commit 477de354dd1caccebb897357af3c2d1844c53520
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Fri Nov 13 08:02:58 2026 +0800

    [docs](3.x) Clarify DATE_TRUNC argument-order availability (#4619)
    
    The 3.x DATE_TRUNC reference lists both argument orders without stating
    when the time-unit-first form became available. On older 3.0 releases,
    `DATE_TRUNC('year', '2025-04-28 12:12:12')` raises the reported
    second-argument error.
    
    Document both-order support from 3.0.5 (also present throughout 3.1),
    direct earlier 3.0 users to the datetime-first form, and show equivalent
    year-truncation examples in English and Chinese.
    
    Fixes #2339. Also addresses the version ambiguity reported in #4108.
    
    Source evidence: [3.0 backport
    #49660](https://github.com/apache/doris/pull/49660), commit
    `85c820723754825af1010e415590a94a7e154dc4`. Its parent accepts the time
    unit only as the second argument; the change adds both-order signatures,
    validation, execution and regression coverage. The first 3.0 release tag
    containing it is `3.0.5-rc01`; the 3.1 release history also contains it.
    
    ## Review and validation
    
    | Checkpoint | Conclusion |
    | --- | --- |
    | Goal | Explains the reported error and supplies the compatible
    argument order. |
    | Scope | Version note and one paired example in existing 3.x function
    pages. |
    | Versions/locales | 3.x EN/ZH synchronized. Dev/4.x already support
    both orders; archives untouched. |
    | Links/navigation | No route, heading, sidebar or link changes. |
    | Framework | Not affected. |
    | Validation | Source and release-tag ancestry checked; paired
    SQL/output blocks match; JSON front matter parsed; `git diff --check`
    passed. No live SQL or site build run. |
    | Other issues | No introduced issue found in self-review; no exact
    patch version inferred for either reporter. |
    
    ## Versions
    
    - [ ] dev
    - [ ] 4.x
    - [x] 3.x
    - [ ] 2.1 or older
    
    ## Languages
    
    - [x] Chinese
    - [x] English
    
    ## Docs Checklist
    
    - [x] Checked by AI
    - [ ] Test Cases Built
    - [x] Updated required version and language counterparts, or explained
    why not
    - [x] Updated both language counterparts
    
    Co-authored-by: morningman <[email protected]>
---
 .../date-time-functions/date-trunc.md              | 28 ++++++++++++++++++++++
 .../date-time-functions/date-trunc.md              | 28 ++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/date-time-functions/date-trunc.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/date-time-functions/date-trunc.md
index 2e29b42e000a..c486c230a248 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/date-time-functions/date-trunc.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/date-time-functions/date-trunc.md
@@ -17,6 +17,8 @@ DATE_TRUNC(<datetime>, <time_unit>)
 DATE_TRUNC(<time_unit>, <datetime>)
 ```
 
+从 Doris 3.0.5 起,`DATE_TRUNC` 支持以上两种参数顺序;Doris 3.1 也支持两种顺序。在 Doris 3.0.5 之前的 
3.0 版本中,请使用 `DATE_TRUNC(<datetime>, <time_unit>)`,将时间单位放在第二个参数。
+
 ## 参数
 
 | 参数 | 说明 |
@@ -30,6 +32,32 @@ DATE_TRUNC(<time_unit>, <datetime>)
 
 ## 举例
 
+以下两种写法均适用于 Doris 3.0.5 及更高的 3.x 版本,结果相同:
+
+```sql
+SELECT DATE_TRUNC('2025-04-28 12:12:12', 'year') AS truncated;
+```
+
+```text
++---------------------+
+| truncated           |
++---------------------+
+| 2025-01-01 00:00:00 |
++---------------------+
+```
+
+```sql
+SELECT DATE_TRUNC('year', '2025-04-28 12:12:12') AS truncated;
+```
+
+```text
++---------------------+
+| truncated           |
++---------------------+
+| 2025-01-01 00:00:00 |
++---------------------+
+```
+
 ```sql
 select date_trunc('2010-12-02 19:28:30', 'second');
 ```
diff --git 
a/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/date-time-functions/date-trunc.md
 
b/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/date-time-functions/date-trunc.md
index e2851b2ed570..ad48bcde3173 100644
--- 
a/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/date-time-functions/date-trunc.md
+++ 
b/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/date-time-functions/date-trunc.md
@@ -17,6 +17,8 @@ DATE_TRUNC(<datetime>, <time_unit>)
 DATE_TRUNC(<time_unit>, <datetime>)
 ```
 
+Since Doris 3.0.5, `DATE_TRUNC` supports both argument orders shown above; 
Doris 3.1 also supports both. In Doris 3.0 releases before 3.0.5, use 
`DATE_TRUNC(<datetime>, <time_unit>)`, with the time unit as the second 
argument.
+
 ## Parameters
 
 | Parameter     | Description |
@@ -30,6 +32,32 @@ The time truncated according to the specified time unit.
 
 ## Examples
 
+Both forms return the same result in Doris 3.0.5 and later 3.x releases:
+
+```sql
+SELECT DATE_TRUNC('2025-04-28 12:12:12', 'year') AS truncated;
+```
+
+```text
++---------------------+
+| truncated           |
++---------------------+
+| 2025-01-01 00:00:00 |
++---------------------+
+```
+
+```sql
+SELECT DATE_TRUNC('year', '2025-04-28 12:12:12') AS truncated;
+```
+
+```text
++---------------------+
+| truncated           |
++---------------------+
+| 2025-01-01 00:00:00 |
++---------------------+
+```
+
 ```sql
 select date_trunc('2010-12-02 19:28:30', 'second');
 ```


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to