1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008-2009 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_OPTIMIZER_QUICK_ROR_UNION_SELECT_H
21
#define DRIZZLED_OPTIMIZER_QUICK_ROR_UNION_SELECT_H
23
#include "drizzled/optimizer/range.h"
33
class compare_functor;
36
Rowid-Ordered Retrieval index union select.
37
This quick select produces union of row sequences returned by several
38
quick select it "merges".
40
All merged quick selects must return rowids in rowid order.
41
QuickRorUnionSelect will return rows in rowid order, too.
43
All merged quick selects are set not to retrieve full table records.
44
ROR-union quick select always retrieves full records.
47
class QuickRorUnionSelect : public QuickSelectInterface
50
QuickRorUnionSelect(Session *session, Table *table);
51
~QuickRorUnionSelect();
54
* Do post-constructor initialization.
56
* QuickRorUnionSelect::init()
60
* @retval other Error code
65
* Initialize quick select for row retrieval.
71
* @retval other Error code
76
* Retrieve next record.
78
* QuickRorUnionSelect::get_next()
81
* Enter/exit invariant:
82
* For each quick select in the queue a {key,rowid} tuple has been
83
* retrieved but the corresponding row hasn't been passed to output.
87
* @retval other - Error code if any error occurred.
91
bool reverse_sorted() const
96
bool unique_key_range() const
103
return QS_TYPE_ROR_UNION;
106
void add_keys_and_lengths(String *key_names, String *used_lengths);
107
void add_info_string(String *str);
108
bool is_keys_used(const MyBitmap *fields);
110
bool push_quick_back(QuickSelectInterface *quick_sel_range);
112
std::vector<QuickSelectInterface *> quick_selects; /**< Merged quick selects */
114
/** Priority queue for merge operation */
115
std::priority_queue<QuickSelectInterface *, std::vector<QuickSelectInterface *>, compare_functor > *queue;
116
MEM_ROOT alloc; /**< Memory pool for this and merged quick selects data. */
118
Session *session; /**< current thread */
119
unsigned char *cur_rowid; /**< buffer used in get_next() */
120
unsigned char *prev_rowid; /**< rowid of last row returned by get_next() */
121
bool have_prev_rowid; /**< true if prev_rowid has valid data */
122
uint32_t rowid_length; /**< table rowid length */
127
} /* namespace optimizer */
129
} /* namespace drizzled */
131
#endif /* DRIZZLED_OPTIMIZER_QUICK_ROR_UNION_SELECT_H */