apache / apache/doris-website

[doc] RETENTION examples: example 4 references a non-existent column; example 3 expected output contradicts its INSERT

Open
#3,904 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
MDX
Stars
133
Forks
464
Avg merge
1d 1h
Merged PRs (30d)
50

Description

Verifying the `RETENTION` aggregate-function page (`sql-manual/sql-functions/aggregate-functions/retention.md`) on a live cluster (master daily; same text in version-3.x / version-4.x) surfaced two doc bugs. The page creates its own tables, so these are content errors, not missing setup.

**Bug 1 — example 4 queries a column that doesn't exist (errors instead of returning NULL)**

```sql
SELECT RETENTION(date = '2022-10-12') AS r FROM retention_test2 where uid is NULL;
```
`retention_test2` is defined as `(uid int, flag boolean, flag2 boolean)` — there is no `date` column, so this fails with:
`errCode = 2, detailMessage = Unknown column 'date' in 'table list'`.
The example's intent ("empty aggregation returns NULL") would be shown correctly with a column that exists, e.g. `SELECT RETENTION(flag) AS r FROM retention_test2 WHERE uid IS NULL;` (the `WHERE uid IS NULL` already filters to zero rows → NULL).

**Bug 2 — example 3 printed output contradicts its own INSERT**

```sql
INSERT into retention_test2 values (0, false, false), (1, true, NULL);
SELECT * from retention_test2;
```
The doc prints:
```
| uid | flag | flag2 |
| 0 | 1 | NULL |
| 1 | 0 | 0 |
```
but the inserted rows are `(0, false, false)` and `(1, true, NULL)`, i.e. the actual result is `(0, 0, 0)` and `(1, 1, NULL)`. The printed flag/flag2 values don't match the INSERT (they look transposed). The expected output should be corrected to match the data.

Both reproduce on a fresh single-BE cluster. Happy to send a PR correcting example 4's column and example 3's expected output if that direction is agreed.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.