[MCOL-4455] "SELECT DISTINCT col FROM table LIMIT O,N" ignores offset Created: 2020-12-16  Updated: 2021-01-25  Resolved: 2021-01-25

Status: Closed
Project: MariaDB ColumnStore
Component/s: ExeMgr
Affects Version/s: None
Fix Version/s: 5.5.2

Type: Bug Priority: Major
Reporter: Alexey Antipovsky (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
causes MCOL-4505 Regression: DISTINCT with sub query g... Closed
Relates
relates to MCOL-4453 CREATE TABLE t2 AS SELECT..LIMIT 0 er... Closed

 Description   

DROP TABLE IF EXISTS a;
CREATE TABLE a (a INT) ENGINE=Columnstore;
INSERT INTO a VALUES (1), (1), (2), (3);
SELECT DISTINCT a FROM a LIMIT 2;
/*
+------+
| a    |
+------+
|    1 |
|    2 |
+------+
*/
SELECT DISTINCT a FROM a LIMIT 2,2;
/*
+------+
| a    |
+------+
|    1 |
|    2 |
+------+
Expected:
+------+
| a    |
+------+
|    3 |
+------+
*/
SELECT DISTINCT a FROM a ORDER BY 1 LIMIT 2,2;
/*
+------+
| a    |
+------+
|    3 |
+------+
*/



 Comments   
Comment by Daniel Lee (Inactive) [ 2021-01-25 ]

Build verified: 5.5.2 (b1552), develop b1546
The fixed also checked into the develop branch

Comment by Daniel Lee (Inactive) [ 2021-01-25 ]

MariaDB [mytest]> DROP TABLE IF EXISTS a;
Query OK, 0 rows affected (0.150 sec)

MariaDB [mytest]> CREATE TABLE a (a INT) ENGINE=Columnstore;
Query OK, 0 rows affected (0.128 sec)

MariaDB [mytest]> INSERT INTO a VALUES (1), (1), (2), (3);
Query OK, 4 rows affected (0.201 sec)
Records: 4 Duplicates: 0 Warnings: 0

MariaDB [mytest]> SELECT DISTINCT a FROM a LIMIT 2;
------

a

------

1
2

------
2 rows in set (0.518 sec)

MariaDB [mytest]> SELECT DISTINCT a FROM a LIMIT 2,2;
------

a

------

3

------
1 row in set (0.041 sec)

MariaDB [mytest]> SELECT DISTINCT a FROM a ORDER BY 1 LIMIT 2,2;
------

a

------

3

------
1 row in set (0.040 sec)

Generated at Thu Feb 08 02:50:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.