1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-9695: Wrong window frame when using RANGE BETWEEN N FOLLOWING AND PRECEDING

Part#1: Frame_n_rows::next_partition() should not assume that the
current table->record[0] points to the first row in the partition.

Since cursor supports move_to() operation, we dont need this.
This commit is contained in:
Sergei Petrunia
2016-03-10 17:46:47 +03:00
parent 89383812b0
commit 0e9fb982f1
3 changed files with 48 additions and 11 deletions

View File

@ -650,16 +650,8 @@ public:
{
if (rownum != 0)
{
/*
The cursor in "ROWS n PRECEDING" lags behind by n_rows rows.
Catch up.
TODO: change this to be a jump forward.
*/
while (!(cursor_eof= (0 != cursor.get_next())))
{
if (bound_tracker.check_if_next_group())
break;
}
/* The cursor in "ROWS n PRECEDING" lags behind by n_rows rows. */
cursor.move_to(rownum);
}
n_rows_to_skip= n_rows - (is_top_bound? 0:1);
}
@ -717,7 +709,7 @@ private:
{
if (!(cursor_eof= (0 != cursor.get_next())))
{
bool new_group= bound_tracker.check_if_next_group();
bool new_group= is_preceding? false: bound_tracker.check_if_next_group();
if (at_partition_start || !new_group)
{
if (is_top_bound) // this is frame start endpoint