query with CUME_DIST() not raising error in TiDB .
- 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
drop table if exists t;
CREATE TABLE t (a BIGINT,b INT);
INSERT INTO t VALUES (1000,1);
INSERT INTO t VALUES (1,2);
SELECT b, CUME_DIST() OVER (
PARTITION BY b ORDER BY a RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING
) FROM t;
```
### 2. What did you expect to see? (Required)
```sql
mysql> SELECT b, CUME_DIST() OVER (
-> PARTITION BY b ORDER BY a RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING
-> ) FROM t;
ERROR 1690 (22003): BIGINT value is out of range in '((`test`.`t`.`a`) + 1)'
```
### 3. What did you see instead (Required)
```sql
mysql> SELECT b, CUME_DIST() OVER (
-> PARTITION BY b ORDER BY a RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING
-> ) FROM t;
+------+--------------------------------------------------------------------------------------------+
| b | CUME_DIST() OVER (
PARTITION BY b ORDER BY a RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING
) |
+------+--------------------------------------------------------------------------------------------+
| 2 | 1 |
| 1 | 1 |
+------+--------------------------------------------------------------------------------------------+
```
### 4. What is your TiDB version? (Required)
```sql
| Release Version: v6.1.0-alpha-238-gd63a5fd33
Edition: Community
Git Commit Hash: d63a5fd33dee1c6eef907ca7fae16972cc403557
Git Branch: master
UTC Build Time: 2022-05-13 00:59:51
GoVersion: go1.18.1
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
```
Contributor guide
Assessment
This issue has not been assessed yet.