Commit graph

6 commits

Author SHA1 Message Date
Dmitry Shulga
fa45400d77 MDEV-26149: The test main.fetch_first fails in case it is run in PS mode
The root cause of test failure is that on optimization
of the statement clause 'order by (select 1)' in outer select
is done incorrect in case the statement run in PS mode.
2021-07-19 17:16:54 +07:00
Vicențiu Ciorbaru
c29f45ce77 MDEV-25481 Memory leak in Cached_item_str::Cached_item_str WITH TIES involving a blob
Make sure to call cached item's destructors.
2021-06-29 00:13:57 +03:00
Dmitry Shulga
510662e81b MDEV-16708: more fixes to test cases 2021-06-17 19:30:24 +02:00
Vicențiu Ciorbaru
aeccdddedd MDEV-25441 WITH TIES is not respected with SQL_BUFFER_RESULT and constant in ORDER BY
Pushing LIMIT to temp aggregation table is possible, but not when WITH
TIES is used. In a degenerate case with constant ORDER BY, the constant
gets removed and the code assumed the limit is push-able.

Ensure that if WITH TIES is present, that this does not happen.
2021-04-21 14:09:17 +03:00
Vicențiu Ciorbaru
44a6af65f5 MDEV-25430: ROW | ROWS should be a required keyword after OFFSET start
Implemented according to standard OFFSET start { ROW | ROWS},
ROW and ROWS is mandatory after OFFSET.
2021-04-21 14:09:17 +03:00
Vicențiu Ciorbaru
299b935320 MDEV-23908: Implement SELECT ... OFFSET ... FETCH ...
This commit implements the standard SQL extension
OFFSET start { ROW | ROWS }
[FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }]

To achieve this a reserved keyword OFFSET is introduced.

The general logic for WITH TIES implies:
1. The number of rows a query returns is no longer known during optimize
   phase. Adjust optimizations to no longer consider this.
2. During end_send make use of an "order Cached_item"to compare if the
   ORDER BY columns changed. Keep returning rows until there is a
   change. This happens only after we reached the row limit.
3. Within end_send_group, the order by clause was eliminated. It is
   still possible to keep the optimization of using end_send_group for
   producing the final result set.
2021-04-21 14:09:14 +03:00