Skip to content

Commit

Permalink
Convert Partition_read_cursor to inherit from Table_read_cursor
Browse files Browse the repository at this point in the history
The 'IS A' relation is more appropriate for Partition_read_cursor. This
also helps with accessing methods available only to Table_read_cursor.
  • Loading branch information
cvicentiu committed Sep 9, 2016
1 parent 1adc3fa commit 3ba867b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions sql/sql_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -647,15 +647,15 @@ class Table_read_cursor : public Rowid_seq_cursor
end, and it needs an explicit command to move to the next partition.
*/

class Partition_read_cursor
class Partition_read_cursor : public Table_read_cursor
{
public:
Partition_read_cursor(THD *thd, SQL_I_List<ORDER> *partition_list) :
bound_tracker(thd, partition_list) {}

void init(READ_RECORD *info)
{
tbl_cursor.init(info);
Table_read_cursor::init(info);
bound_tracker.init();
end_of_partition= false;
}
Expand All @@ -676,7 +676,7 @@ class Partition_read_cursor
/*
Moves to a new row. The row is assumed to be within the current partition.
*/
void move_to(ha_rows rownum) { tbl_cursor.move_to(rownum); }
void move_to(ha_rows rownum) { Table_read_cursor::move_to(rownum); }

/*
This returns -1 when end of partition was reached.
Expand All @@ -686,7 +686,7 @@ class Partition_read_cursor
int res;
if (end_of_partition)
return -1;
if ((res= tbl_cursor.get_next()))
if ((res= Table_read_cursor::get_next()))
return res;

if (bound_tracker.compare_with_cache())
Expand All @@ -699,11 +699,10 @@ class Partition_read_cursor

bool restore_last_row()
{
return tbl_cursor.restore_last_row();
return Table_read_cursor::restore_last_row();
}

private:
Table_read_cursor tbl_cursor;
Group_bound_tracker bound_tracker;
bool end_of_partition;
};
Expand Down

0 comments on commit 3ba867b

Please sign in to comment.