~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/quick_range_select.h

  • Committer: Brian Aker
  • Date: 2010-05-15 01:19:45 UTC
  • Revision ID: brian@gaz-20100515011945-uxhf94vi0tzm0vq6
Rename of KEY to KeyInfo

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 */
41
41
class QuickRangeSelect : public QuickSelectInterface
42
42
{
 
43
protected:
 
44
  Cursor *cursor;
 
45
  DYNAMIC_ARRAY ranges; /**< ordered array of range ptrs */
 
46
 
 
47
  /** Members to deal with case when this quick select is a ROR-merged scan */
 
48
  bool in_ror_merged_scan;
 
49
  MyBitmap column_bitmap;
 
50
  MyBitmap *save_read_set;
 
51
  MyBitmap *save_write_set;
 
52
  bool free_file; /**< True when this->file is "owned" by this quick select */
 
53
 
 
54
  /* Range pointers to be used when not using MRR interface */
 
55
  QuickRange **cur_range; /**< current element in ranges  */
 
56
  QuickRange *last_range;
 
57
 
 
58
  /** Members needed to use the MRR interface */
 
59
  QuickRangeSequenceContext qr_traversal_ctx;
 
60
  uint32_t mrr_buf_size; /**< copy from session->variables.read_rnd_buff_size */
 
61
  HANDLER_BUFFER *mrr_buf_desc; /**< the Cursor buffer */
 
62
 
 
63
  /** Info about index we're scanning */
 
64
  KEY_PART *key_parts;
 
65
  KeyPartInfo *key_part_info;
 
66
 
 
67
  bool dont_free; /**< Used by QuickSelectDescending */
 
68
 
 
69
  /**
 
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().
 
73
   */
 
74
  int cmp_next(QuickRange *range);
 
75
 
 
76
  /**
 
77
   * @return 0 if found key is inside range (found key >= range->min_key).
 
78
   */
 
79
  int cmp_prev(QuickRange *range);
 
80
 
 
81
  /**
 
82
   * Check if current row will be retrieved by this QuickRangeSelect
 
83
   *
 
84
   * NOTES
 
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
 
87
   * quick select.
 
88
   * The implementation does a binary search on sorted array of disjoint
 
89
   * ranges, without taking size of range into account.
 
90
   *
 
91
   * This function is used to filter out clustered PK scan rows in
 
92
   * index_merge quick select.
 
93
   *
 
94
   * RETURN
 
95
   * @retval true  if current row will be retrieved by this quick select
 
96
   * false if not
 
97
   */
 
98
  bool row_in_ranges();
43
99
 
44
100
public:
45
101
 
157
213
    cursor= NULL;
158
214
  }
159
215
 
160
 
protected:
161
 
 
162
 
  Cursor *cursor;
163
 
  DYNAMIC_ARRAY ranges; /**< ordered array of range ptrs */
164
 
 
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 */
171
 
 
172
 
  /* Range pointers to be used when not using MRR interface */
173
 
  QuickRange **cur_range; /**< current element in ranges  */
174
 
  QuickRange *last_range;
175
 
 
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 */
180
 
 
181
 
  /** Info about index we're scanning */
182
 
  KEY_PART *key_parts;
183
 
  KEY_PART_INFO *key_part_info;
184
 
 
185
 
  bool dont_free; /**< Used by QuickSelectDescending */
186
 
 
187
 
  /**
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().
191
 
   */
192
 
  int cmp_next(QuickRange *range);
193
 
 
194
 
  /**
195
 
   * @return 0 if found key is inside range (found key >= range->min_key).
196
 
   */
197
 
  int cmp_prev(QuickRange *range);
198
 
 
199
 
  /**
200
 
   * Check if current row will be retrieved by this QuickRangeSelect
201
 
   *
202
 
   * NOTES
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
205
 
   * quick select.
206
 
   * The implementation does a binary search on sorted array of disjoint
207
 
   * ranges, without taking size of range into account.
208
 
   *
209
 
   * This function is used to filter out clustered PK scan rows in
210
 
   * index_merge quick select.
211
 
   *
212
 
   * RETURN
213
 
   * @retval true  if current row will be retrieved by this quick select
214
 
   * false if not
215
 
   */
216
 
  bool row_in_ranges();
217
 
 
218
216
private:
219
217
 
220
218
  /* Used only by QuickSelectDescending */