Drizzled Public API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
quick_group_min_max_select.h
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
*
4
* Copyright (C) 2008-2009 Sun Microsystems, Inc.
5
*
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.
9
*
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.
14
*
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
18
*/
19
20
#pragma once
21
22
#include <drizzled/optimizer/range.h>
23
24
#include <vector>
25
26
namespace
drizzled
27
{
28
29
namespace
optimizer
30
{
31
64
class
QuickGroupMinMaxSelect
:
public
QuickSelectInterface
65
{
66
67
private
:
68
69
Cursor
*
cursor
;
70
Join
*
join
;
71
KeyInfo
*
index_info
;
72
unsigned
char
*
record
;
73
unsigned
char
*
tmp_record
;
74
unsigned
char
*
group_prefix
;
75
uint32_t
group_prefix_len
;
76
uint32_t
group_key_parts
;
77
unsigned
char
*
last_prefix
;
78
bool
have_min
;
79
bool
have_max
;
80
bool
seen_first_key
;
81
KeyPartInfo
*min_max_arg_part;
82
uint32_t
min_max_arg_len
;
83
unsigned
char
*
key_infix
;
84
uint32_t key_infix_len;
85
std::vector<QuickRange *>
min_max_ranges
;
86
uint32_t
real_prefix_len
;
87
uint32_t
real_key_parts
;
88
List<Item_sum>
*min_functions;
89
List<Item_sum>
*max_functions;
90
List<Item_sum>::iterator
*min_functions_it;
91
List<Item_sum>::iterator
*max_functions_it;
92
93
public
:
94
95
/*
96
The following two members are public to allow easy access from
97
GroupMinMaxReadPlan::make_quick()
98
*/
99
memory::Root
alloc
;
100
QuickRangeSelect
*
quick_prefix_select
;
102
private
:
103
125
int
next_prefix
();
126
146
int
next_min_in_range
();
147
167
int
next_max_in_range
();
168
191
int
next_min
();
192
208
int
next_max
();
209
232
void
update_min_result
();
233
255
void
update_max_result
();
256
257
public
:
258
259
/*
260
Construct new quick select for group queries with min/max.
261
262
SYNOPSIS
263
QuickGroupMinMaxSelect::QuickGroupMinMaxSelect()
264
table The table being accessed
265
join Descriptor of the current query
266
have_min true if the query selects a MIN function
267
have_max true if the query selects a MAX function
268
min_max_arg_part The only argument field of all MIN/MAX functions
269
group_prefix_len Length of all key parts in the group prefix
270
prefix_key_parts All key parts in the group prefix
271
index_info The index chosen for data access
272
use_index The id of index_info
273
read_cost Cost of this access method
274
records Number of records returned
275
key_infix_len Length of the key infix appended to the group prefix
276
key_infix Infix of constants from equality predicates
277
parent_alloc Memory pool for this and quick_prefix_select data
278
279
RETURN
280
None
281
*/
282
QuickGroupMinMaxSelect
(
Table
*table,
283
Join
*
join
,
284
bool
have_min
,
285
bool
have_max
,
286
KeyPartInfo
*min_max_arg_part,
287
uint32_t
group_prefix_len
,
288
uint32_t
group_key_parts
,
289
uint32_t
used_key_parts
,
290
KeyInfo
*
index_info
,
291
uint use_index,
292
double
read_cost,
293
ha_rows
records
,
294
uint key_infix_len,
295
unsigned
char
*
key_infix
,
296
memory::Root
*parent_alloc);
297
298
~
QuickGroupMinMaxSelect
();
299
317
bool
add_range
(
SEL_ARG
*sel_range);
318
339
void
update_key_stat
();
340
358
void
adjust_prefix_ranges
();
359
360
bool
alloc_buffers();
361
378
int
init
();
379
394
int
reset
();
395
422
int
get_next
();
423
424
bool
reverse_sorted()
const
425
{
426
return
false
;
427
}
428
429
bool
unique_key_range()
const
430
{
431
return
false
;
432
}
433
434
int
get_type
()
const
435
{
436
return
QS_TYPE_GROUP_MIN_MAX;
437
}
438
452
void
add_keys_and_lengths
(std::string *key_names, std::string *used_lengths);
453
454
};
455
456
457
}
/* namespace optimizer */
458
459
}
/* namespace drizzled */
460
drizzled
optimizer
quick_group_min_max_select.h
Generated on Tue Jun 19 2012 18:56:49 for drizzle by
1.8.1