apache / apache/doris-website

doc bug: EXPLODE_SPLIT example output is not sorted despite ORDER BY (version-3.x/2.1)

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

Description

On the `EXPLODE_SPLIT` page (`table-functions/explode-split.md`, version-3.x and version-2.1), one example shows an output that contradicts its own `ORDER BY`:

```sql
select k1, e1 from example1 lateral view explode_split(k2, ,) tmp1 as e1 where k1 = 5 order by k1, e1;
```
```text
+------+------+
| k1 | e1 |
+------+------+
| 5 | 2 |
| 5 | 3 |
| 5 | 1 |
+------+------+
```

`k2` for `k1 = 5` is `1,2,3`, so `explode_split` yields `1, 2, 3`. With `ORDER BY k1, e1` the rows must come back sorted by `e1` — i.e. `1, 2, 3` — which is exactly what the current engine returns (3.1.4 and 2.1.11). The documented order `2, 3, 1` is not sorted and cannot be produced by the shown query.

Suggested fix — update the expected output to the sorted order:
```text
| 5 | 1 |
| 5 | 2 |
| 5 | 3 |
```

Filing separately from the missing `example1` setup for this page (handled in a Line-B setup PR); all other examples on the page reproduce correctly.

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.