Window function returns incorrect result
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```sql
use test;
drop table if exists test.t3;
create table test.t3 (p int, o int, v varchar(100) not null);
insert into test.t3 values (3, 10, "j7jhgvuev"), (3, 20, "pmgo99f3"), (3, 40, ""), (3, 41, "TGh54h54htever");
select p, o, v, min(v) over w as "min", max(v) over w as "max" from t3 window w as (partition by p order by o rows between 2 preceding and 1 following);
```
### 2. What did you expect to see? (Required)
```
+------+------+----------------+-----------+----------------+
| p | o | v | min | max |
+------+------+----------------+-----------+----------------+
| 3 | 10 | j7jhgvuev | j7jhgvuev | pmgo99f3 |
| 3 | 20 | pmgo99f3 | | pmgo99f3 |
| 3 | 40 | | | TGh54h54htever |
| 3 | 41 | TGh54h54htever | | TGh54h54htever |
+------+------+----------------+-----------+----------------+
```
### 3. What did you see instead (Required)
```
+------+------+----------------+-----------+----------+
| p | o | v | min | max |
+------+------+----------------+-----------+----------+
| 3 | 10 | j7jhgvuev | j7jhgvuev | pmgo99f3 |
| 3 | 20 | pmgo99f3 | | pmgo99f3 |
| 3 | 40 | | | pmgo99f3 |
| 3 | 41 | TGh54h54htever | | pmgo99f3 |
+------+------+----------------+-----------+----------+
```
### 4. What is your TiDB version? (Required)
nightly(c44672e0c51c4e50391ffc43902c980eef4c64cb)
Contributor guide
Assessment
This issue has not been assessed yet.