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

Window Function: not report error when a illegal windown not use (inconsistent with mysql) #12356

Closed
DQinYuan opened this issue Sep 24, 2019 · 3 comments · Fixed by #21083
Closed
Assignees
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@DQinYuan
Copy link
Contributor

Bug Report

  1. What did you do?
create table temptest (val int, val1 int);

SELECT val FROM temptest WINDOW w AS (ORDER BY val, val1 RANGE 1 PRECEDING);

Note that there have an unuse window w in select

  1. What did you expect to see?

In Mysql 8.0.16

mysql> create table temptest (val int, val1 int);
Query OK, 0 rows affected (0.05 sec)

mysql> SELECT val FROM temptest WINDOW w AS (ORDER BY val, val1 RANGE 1 PRECEDING);
ERROR 3587 (HY000): Window 'w' with RANGE N PRECEDING/FOLLOWING frame requires exactly one ORDER BY expression, of numeric or temporal type
  1. What did you see instead?

In TiDB

mysql> create table temptest (val int, val1 int);
Query OK, 0 rows affected (0.16 sec)

mysql> SELECT val FROM temptest WINDOW w AS (ORDER BY val, val1 RANGE 1 PRECEDING);
Empty set (0.01 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
mysql> select tidb_version();
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                       |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v3.0.3
Git Commit Hash: 836982c617fbaa42d74616eb9ba9ed4cae46c46b
Git Branch: HEAD
UTC Build Time: 2019-08-30 02:42:42
GoVersion: go version go1.12 linux/amd64
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
@DQinYuan DQinYuan added the type/bug The issue is confirmed as a bug. label Sep 24, 2019
@winkyao winkyao assigned winkyao and crazycs520 and unassigned winkyao and crazycs520 Sep 24, 2019
@ghost
Copy link

ghost commented Jul 15, 2020

Confirming that I can reproduce this in master:

DROP TABLE IF EXISTS temptest;
create table temptest (val int, val1 int);
SELECT val FROM temptest WINDOW w AS (ORDER BY val, val1 RANGE 1 PRECEDING);

..


mysql> SELECT val FROM temptest WINDOW w AS (ORDER BY val, val1 RANGE 1 PRECEDING);
Empty set (0.00 sec)


mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-771-gca41972fb
Edition: Community
Git Commit Hash: ca41972fbac068c8a5de107d9075f09ac68842ac
Git Branch: master
UTC Build Time: 2020-07-14 02:41:21
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)

@dyzsr
Copy link
Contributor

dyzsr commented Nov 16, 2020

/assign

@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
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants