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 621a0d26974 [fix](doc) week/weekofyear: backport zh-only examples to
en; fix zh typo using 2023 twice (#3817)
621a0d26974 is described below
commit 621a0d269742f04247bfbeb4e832455588841780
Author: boluor <[email protected]>
AuthorDate: Wed May 27 19:15:08 2026 -0700
[fix](doc) week/weekofyear: backport zh-only examples to en; fix zh typo
using 2023 twice (#3817)
## Summary
Three changes across two date-time function pages.
**EN \`week.md\` (+1 example)**
\`mode 7\` — weeks start on Monday and week 1 is the week containing the
first Monday. Because the first Monday of 2023 is January 2,
\`WEEK('2023-01-01', 7)\` returns 52 (last week of 2022). ZH already had
this example.
**EN \`weekofyear.md\` (+3 examples)**
| SQL | Returns | Why interesting |
|-----|---------|-----------------|
| \`WEEKOFYEAR('2022-01-02')\` | 52 | The week 2021-12-27 to 2022-01-02
has only 2 days in 2022, so it falls in week 52 of 2021 |
| \`WEEKOFYEAR('2023-12-25')\` | 52 | The final week of 2023 |
| \`weekofyear('1023-01-04')\` | 1 | Pre-modern year — the function does
not enforce a minimum year |
ZH already had analogues of these.
**ZH \`weekofyear.md\` typo fix**
The cross-year example's prose described the 2021-12-27..2022-01-02
week, but the SQL was \`WEEKOFYEAR('2023-01-02')\` and returned 1 —
wrong week for the prose, and a duplicate of the example just above.
Change the SQL and alias to \`'2022-01-02'\` / \`week_20220102\` so the
example actually demonstrates what the comment says (returns 52).
## Verification
\`\`\`
mysql> SELECT WEEK('2023-01-01', 7); -- 52
mysql> SELECT WEEKOFYEAR('2022-01-02'); -- 52
mysql> SELECT WEEKOFYEAR('2023-12-25'); -- 52
mysql> SELECT weekofyear('1023-01-04'); -- 1
\`\`\`
## Test plan
- [x] All added examples verified on Apache Doris 4.1.1.
- [x] ZH weekofyear typo no longer duplicates the previous example.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
---
.../date-time-functions/weekofyear.md | 8 +++----
.../scalar-functions/date-time-functions/week.md | 9 ++++++++
.../date-time-functions/weekofyear.md | 26 ++++++++++++++++++++++
3 files changed, 39 insertions(+), 4 deletions(-)
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/weekofyear.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/weekofyear.md
index a381df2f74d..dc8ef59abc1 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/weekofyear.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/weekofyear.md
@@ -52,12 +52,12 @@ SELECT WEEKOFYEAR('2023-01-02') AS week_20230102;
| 1 |
+---------------+
--- 2021-12-27(星期一)至 2022-01-02(星期日)这一周,2022 年的天数仅 2 天(1-2 日 <4),故属于 2021 年
-SELECT WEEKOFYEAR('2023-01-02') AS week_20230102;
+-- 2021-12-27(星期一)至 2022-01-02(星期日)这一周,2022 年的天数仅 2 天(1-2 日 <4),故属于 2021 年第 52
周
+SELECT WEEKOFYEAR('2022-01-02') AS week_20220102;
+---------------+
-| week_20230102 |
+| week_20220102 |
+---------------+
-| 1 |
+| 52 |
+---------------+
-- 说明:2023-12-25 至 2023-12-31(星期日)这一周,包含 2023 年的天数为 7 天(≥4),属于 2023 年
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/week.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/week.md
index d45fe2a6a91..44c0a39e45a 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/week.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/week.md
@@ -97,4 +97,13 @@ SELECT WEEK('2023-12-31 23:59:59', NULL), WEEK(NULL, 3);
+-----------------------------------+--------------+
| NULL | NULL |
+-----------------------------------+--------------+
+
+-- Mode 7: weeks start on Monday and week 1 is the week containing the first
Monday;
+-- the first Monday of 2023 is Jan 2, so 2023-01-01 falls in the last week of
2022 (week 52)
+SELECT WEEK('2023-01-01', 7) AS week_result;
++-------------+
+| week_result |
++-------------+
+| 52 |
++-------------+
```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/weekofyear.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/weekofyear.md
index 51a56de49f3..aaef3a3a831 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/weekofyear.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/weekofyear.md
@@ -59,6 +59,32 @@ SELECT WEEKOFYEAR('2024-01-01') AS week_20240101;
| 1 |
+---------------+
+-- The week 2021-12-27 (Monday) through 2022-01-02 (Sunday) only has 2 days
+-- in 2022 (<4), so it belongs to the last week of 2021 (week 52)
+SELECT WEEKOFYEAR('2022-01-02') AS week_20220102;
++---------------+
+| week_20220102 |
++---------------+
+| 52 |
++---------------+
+
+-- 2023-12-25 (Monday) through 2023-12-31 (Sunday) has 7 days in 2023 (≥4),
+-- so it belongs to week 52 of 2023
+SELECT WEEKOFYEAR('2023-12-25') AS week_20231225;
++---------------+
+| week_20231225 |
++---------------+
+| 52 |
++---------------+
+
+-- Pre-modern dates work too — the function does not validate a minimum year
+SELECT weekofyear('1023-01-04');
++--------------------------+
+| weekofyear('1023-01-04') |
++--------------------------+
+| 1 |
++--------------------------+
+
-- NULL input (returns NULL)
SELECT WEEKOFYEAR(NULL) AS week_null_input;
+-----------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]