[MDEV-16327] Server doesn't account for engines that supports OFFSET on their own. Created: 2018-05-30  Updated: 2021-04-21  Resolved: 2019-10-13

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Fix Version/s: 10.5.0

Type: Task Priority: Critical
Reporter: Roman Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MCOL-1052 Implement GROUP BY pushdown support Closed
Relates
relates to MCOL-3903 Performance regression in INSERT..SELECT Closed
relates to MDEV-18553 Make LIMIT/OFFSET processing uniform Closed

 Description   

It comes out that server doesn't honors group by handlers that supports OFFSET on their own and the server code in select_send::send_data tries to reapply OFFSET to the set returned by the handler[1]

select i from t1 group by i limit 10,20; # Start from offset 10

There is only engine that supports both group by handler and internal sorting ATM, so one could reproduce this only with columnstore engine built of:

  • develop branch columnstore fork of the server's code
  • develop branch columnstore engine

1. https://hastebin.com/afepesalez.cs



 Comments   
Comment by Oleksandr Byelkin [ 2019-01-15 ]

monty, serg, drrtuy: Hi! As I can see (maybe I am wrong) group by handler do not signal what condition it accept and process (so we have to check HAVING twice for example), naturally it will not work for OFFSET, so I think of call like group_by_handler::is_limit_processed() (false by default) to remove LIMIT/OFFSET for the query if it will be processed by the engine. Is it OK?

Comment by Roman [ 2019-01-15 ]

According to comments in group_by_handler.h the handler instance signals whether it supports a feature or not but setting NULL to any Query structure's member that handler supports. But at this moment server crashes if I handler doesn't set NULL for any.
If you find your way more suitable then the original then we should change the comments.

Comment by Oleksandr Byelkin [ 2019-01-15 ]

if sorting supported it removed from Query

Comment by Alexander Barkov [ 2019-10-11 ]

Ok to push.

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