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 3f84d1e5654 [fix](sql-functions) provide setup data for MEDIAN example 
(dev) (#3903)
3f84d1e5654 is described below

commit 3f84d1e56541c2ce8a18a349db729a5455dca811
Author: boluor <[email protected]>
AuthorDate: Tue Jun 9 20:53:44 2026 -0700

    [fix](sql-functions) provide setup data for MEDIAN example (dev) (#3903)
    
    The dev `MEDIAN` page queried `log_statis` without defining it, so the
    example errored with `table does not exist`; its second example's SQL
    and printed output were also mismatched.
    
    Port the **version-4.x** Example section to dev (EN+ZH): a `-- setup`
    block that creates `log_statis` and loads rows whose per-group medians
    are exactly the `50` / `30` the doc prints (`MEDIAN` = `percentile 0.5`
    is deterministic), plus the self-consistent NULL example. version-4.x
    already has this and is unchanged. (MEDIAN only exists in dev + 4.x.)
    
    **Verification** — executed end-to-end on the local master daily build
    (doris-0.0.0-2e72603618c): dev EN **P4 F0**, dev ZH **P4 F0**, every
    touched example reproducing the doc's printed output cell-for-cell.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
---
 .../sql-functions/aggregate-functions/median.md      | 20 ++++++++++++++++++--
 .../sql-functions/aggregate-functions/median.md      |  2 +-
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/docs/sql-manual/sql-functions/aggregate-functions/median.md 
b/docs/sql-manual/sql-functions/aggregate-functions/median.md
index df0f80304c4..a79e2595dd4 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/median.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/median.md
@@ -29,6 +29,22 @@ Returns NULL if there is no valid data in the group.
 
 ## Example
 
+```sql
+-- setup
+create table log_statis(
+    datetime datetime,
+    scan_rows int
+) distributed by hash(datetime) buckets 1
+properties ("replication_num"="1");
+insert into log_statis values
+    ('2025-08-25 10:00:00', 10),
+    ('2025-08-25 10:00:00', 50),
+    ('2025-08-25 10:00:00', 100),
+    ('2025-08-25 11:00:00', 20),
+    ('2025-08-25 11:00:00', 30),
+    ('2025-08-25 11:00:00', 40);
+```
+
 ```sql
 select datetime, median(scan_rows) from log_statis group by datetime;
 ```
@@ -44,7 +60,7 @@ select datetime, median(scan_rows) from log_statis group by 
datetime;
 ```
 
 ```sql
-select median(scan_rows) from log_statis group by datetime;
+select median(scan_rows) from log_statis where scan_rows is null;
 ```
 
 ```text
@@ -54,4 +70,4 @@ select median(scan_rows) from log_statis where scan_rows is 
null;
 +-------------------+
 |              NULL |
 +-------------------+
-```
\ No newline at end of file
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/median.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/median.md
index 591f544f6ce..4ea2b6415dd 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/median.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/median.md
@@ -60,7 +60,7 @@ select datetime, median(scan_rows) from log_statis group by 
datetime;
 ```
 
 ```sql
-select median(scan_rows) from log_statis group by datetime;
+select median(scan_rows) from log_statis where scan_rows is null;
 ```
 
 ```text


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

Reply via email to