[MCOL-198] ORDER BY in subquery does not work as expected (wrong results) Created: 2016-06-24  Updated: 2016-12-22  Resolved: 2016-12-22

Status: Closed
Project: MariaDB ColumnStore
Component/s: MariaDB Server
Affects Version/s: None
Fix Version/s: Icebox

Type: Bug Priority: Major
Reporter: Justin Swanhart (Inactive) Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: community


 Description   

From: https://groups.google.com/forum/#!topic/mariadb-columnstore/xEWtv_bWlwI

Hi all,

while testing I found that the following query type produces unexpected (I'd say wrong) results.

SELECT .. FROM (SELECT .. FROM .. ORDER BY 1) LIMIT 10

That is, if an inner query has an ORDER BY clause and the outer query a LIMIT clause then the ordering is not preserved. This behavior is different from say the InnoDB storage engine. Is that intentional?

Regards,
Arno



 Comments   
Comment by David Thompson (Inactive) [ 2016-12-22 ]

MariaDB server also does not promise to support this. For columnstore it is even harder to support once you factor in distributed execution. Order by is only supported on the outer sql.

Many times what people are trying do here with databases that support this is to simulate window functions where they are not supported. Almost certainly what is being tried to be done here can be better expressed with a window function.

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