1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008-2009 Sun Microsystems, Inc.
4
* Copyright (C) 2008-2009 Sun Microsystems
6
6
* This program is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
42
41
class QuickRangeSelect : public QuickSelectInterface
46
DYNAMIC_ARRAY ranges; /**< ordered array of range ptrs */
48
/** Members to deal with case when this quick select is a ROR-merged scan */
49
bool in_ror_merged_scan;
50
boost::dynamic_bitset<> *column_bitmap;
51
boost::dynamic_bitset<> *save_read_set;
52
boost::dynamic_bitset<> *save_write_set;
53
bool free_file; /**< True when this->file is "owned" by this quick select */
55
/* Range pointers to be used when not using MRR interface */
56
QuickRange **cur_range; /**< current element in ranges */
57
QuickRange *last_range;
59
/** Members needed to use the MRR interface */
60
QuickRangeSequenceContext qr_traversal_ctx;
61
uint32_t mrr_buf_size; /**< copy from session->variables.read_rnd_buff_size */
63
/** Info about index we're scanning */
65
KeyPartInfo *key_part_info;
67
bool dont_free; /**< Used by QuickSelectDescending */
70
* Compare if found key is over max-value
71
* @return 0 if key <= range->max_key
72
* @todo: Figure out why can't this function be as simple as cmp_prev().
74
int cmp_next(QuickRange *range);
77
* @return 0 if found key is inside range (found key >= range->min_key).
79
int cmp_prev(QuickRange *range);
82
* Check if current row will be retrieved by this QuickRangeSelect
85
* It is assumed that currently a scan is being done on another index
86
* which reads all necessary parts of the index that is scanned by this
88
* The implementation does a binary search on sorted array of disjoint
89
* ranges, without taking size of range into account.
91
* This function is used to filter out clustered PK scan rows in
92
* index_merge quick select.
95
* @retval true if current row will be retrieved by this quick select
163
DYNAMIC_ARRAY ranges; /**< ordered array of range ptrs */
165
/** Members to deal with case when this quick select is a ROR-merged scan */
166
bool in_ror_merged_scan;
167
MyBitmap column_bitmap;
168
MyBitmap *save_read_set;
169
MyBitmap *save_write_set;
170
bool free_file; /**< True when this->file is "owned" by this quick select */
172
/* Range pointers to be used when not using MRR interface */
173
QuickRange **cur_range; /**< current element in ranges */
174
QuickRange *last_range;
176
/** Members needed to use the MRR interface */
177
QuickRangeSequenceContext qr_traversal_ctx;
178
uint32_t mrr_buf_size; /**< copy from session->variables.read_rnd_buff_size */
179
HANDLER_BUFFER *mrr_buf_desc; /**< the Cursor buffer */
181
/** Info about index we're scanning */
183
KEY_PART_INFO *key_part_info;
185
bool dont_free; /**< Used by QuickSelectDescending */
188
* Compare if found key is over max-value
189
* @return 0 if key <= range->max_key
190
* @todo: Figure out why can't this function be as simple as cmp_prev().
192
int cmp_next(QuickRange *range);
195
* @return 0 if found key is inside range (found key >= range->min_key).
197
int cmp_prev(QuickRange *range);
200
* Check if current row will be retrieved by this QuickRangeSelect
203
* It is assumed that currently a scan is being done on another index
204
* which reads all necessary parts of the index that is scanned by this
206
* The implementation does a binary search on sorted array of disjoint
207
* ranges, without taking size of range into account.
209
* This function is used to filter out clustered PK scan rows in
210
* index_merge quick select.
213
* @retval true if current row will be retrieved by this quick select
216
bool row_in_ranges();
217
220
/* Used only by QuickSelectDescending */