Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare: incorrect arguments to nth_value #16362

Closed
ChenPeng2013 opened this issue Apr 14, 2020 · 2 comments · Fixed by #18973
Closed

prepare: incorrect arguments to nth_value #16362

ChenPeng2013 opened this issue Apr 14, 2020 · 2 comments · Fixed by #18973
Assignees
Labels

Comments

@ChenPeng2013
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. What did you do?

use test;
drop table if exists t;
create table t(a int, b int);
insert into t values(1,2),(1,3),(2,3),(-1,1),(-1,-1);
prepare stmt from "select sum(b) over w, nth_value(b, ?) over w from t window w as (partition by a)";
set @a=1;
execute stmt using @a;

2. What did you expect to see?

mysql>  execute stmt using @a;
+---------------+------------------------+
| sum(b) over w | nth_value(b, ?) over w |
+---------------+------------------------+
|             0 |                      1 |
|             0 |                      1 |
|             5 |                      2 |
|             5 |                      2 |
|             3 |                      3 |
+---------------+------------------------+
5 rows in set (0.00 sec)

3. What did you see instead?

mysql>  execute stmt using @a;
ERROR 1210 (HY000): Incorrect arguments to nth_value

4. What version of TiDB are you using? (tidb-server -V or run select tidb_version(); on TiDB)

Release Version: v4.0.0-rc-11-g78922a8ab
Git Commit Hash: 78922a8abef2f21e4d8990d37c6c67ac7b0eef42
Git Branch: HEAD
UTC Build Time: 2020-04-14 08:35:18
GoVersion: go1.13.1
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@ChenPeng2013 ChenPeng2013 added the type/bug The issue is confirmed as a bug. label Apr 14, 2020
@zz-jason
Copy link
Member

@lzmhhh123 PTAL

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants