mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
misc fixes for compile-time errors
This commit is contained in:
138
sql/opt_range.h
138
sql/opt_range.h
@ -67,7 +67,7 @@ class QUICK_RANGE :public Sql_alloc {
|
||||
|
||||
|
||||
/*
|
||||
Quick select interface.
|
||||
Quick select interface.
|
||||
This class is a parent for all QUICK_*_SELECT and FT_SELECT classes.
|
||||
*/
|
||||
|
||||
@ -79,7 +79,7 @@ public:
|
||||
double read_time; /* time to perform this retrieval */
|
||||
TABLE *head;
|
||||
/*
|
||||
Index this quick select uses, or MAX_KEY for quick selects
|
||||
Index this quick select uses, or MAX_KEY for quick selects
|
||||
that use several indexes
|
||||
*/
|
||||
uint index;
|
||||
@ -99,35 +99,35 @@ public:
|
||||
|
||||
QUICK_SELECT_I();
|
||||
virtual ~QUICK_SELECT_I(){};
|
||||
|
||||
|
||||
/*
|
||||
Do post-constructor initialization.
|
||||
SYNOPSIS
|
||||
init()
|
||||
|
||||
init() performs initializations that should have been in constructor if
|
||||
it was possible to return errors from constructors. The join optimizer may
|
||||
|
||||
init() performs initializations that should have been in constructor if
|
||||
it was possible to return errors from constructors. The join optimizer may
|
||||
create and then delete quick selects without retrieving any rows so init()
|
||||
must not contain any IO or CPU intensive code.
|
||||
|
||||
If init() call fails the only valid action is to delete this quick select,
|
||||
If init() call fails the only valid action is to delete this quick select,
|
||||
reset() and get_next() must not be called.
|
||||
|
||||
|
||||
RETURN
|
||||
0 OK
|
||||
other Error code
|
||||
*/
|
||||
virtual int init() = 0;
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
Initialize quick select for row retrieval.
|
||||
SYNOPSIS
|
||||
reset()
|
||||
|
||||
reset() should be called when it is certain that row retrieval will be
|
||||
|
||||
reset() should be called when it is certain that row retrieval will be
|
||||
necessary. This call may do heavyweight initialization like buffering first
|
||||
N records etc. If reset() call fails get_next() must not be called.
|
||||
|
||||
|
||||
RETURN
|
||||
0 OK
|
||||
other Error code
|
||||
@ -140,7 +140,7 @@ public:
|
||||
virtual bool reverse_sorted() = 0;
|
||||
virtual bool unique_key_range() { return false; }
|
||||
|
||||
enum {
|
||||
enum {
|
||||
QS_TYPE_RANGE = 0,
|
||||
QS_TYPE_INDEX_MERGE = 1,
|
||||
QS_TYPE_RANGE_DESC = 2,
|
||||
@ -154,7 +154,7 @@ public:
|
||||
|
||||
/*
|
||||
Initialize this quick select as a merged scan inside a ROR-union or a ROR-
|
||||
intersection scan. The caller must not additionally call init() if this
|
||||
intersection scan. The caller must not additionally call init() if this
|
||||
function is called.
|
||||
SYNOPSIS
|
||||
init_ror_merged_scan()
|
||||
@ -162,55 +162,55 @@ public:
|
||||
it must create and use a separate handler object.
|
||||
RETURN
|
||||
0 Ok
|
||||
other Error
|
||||
other Error
|
||||
*/
|
||||
virtual int init_ror_merged_scan(bool reuse_handler)
|
||||
{ DBUG_ASSERT(0); return 1; }
|
||||
|
||||
|
||||
/*
|
||||
Save ROWID of last retrieved row in file->ref. This used in ROR-merging.
|
||||
*/
|
||||
virtual void save_last_pos(){};
|
||||
|
||||
/*
|
||||
/*
|
||||
Append comma-separated list of keys this quick select uses to key_names;
|
||||
append comma-separated list of corresponding used lengths to used_lengths.
|
||||
This is used by select_describe.
|
||||
*/
|
||||
virtual void add_keys_and_lengths(String *key_names,
|
||||
virtual void add_keys_and_lengths(String *key_names,
|
||||
String *used_lengths)=0;
|
||||
|
||||
/*
|
||||
Append text representation of quick select structure (what and how is
|
||||
|
||||
/*
|
||||
Append text representation of quick select structure (what and how is
|
||||
merged) to str. The result is added to "Extra" field in EXPLAIN output.
|
||||
This function is implemented only by quick selects that merge other quick
|
||||
selects output and/or can produce output suitable for merging.
|
||||
*/
|
||||
virtual void add_info_string(String *str) {};
|
||||
/*
|
||||
Return 1 if any index used by this quick select
|
||||
a) uses field that is listed in passed field list or
|
||||
Return 1 if any index used by this quick select
|
||||
a) uses field that is listed in passed field list or
|
||||
b) is automatically updated (like a timestamp)
|
||||
*/
|
||||
virtual bool check_if_keys_used(List<Item> *fields);
|
||||
|
||||
/*
|
||||
rowid of last row retrieved by this quick select. This is used only when
|
||||
doing ROR-index_merge selects
|
||||
rowid of last row retrieved by this quick select. This is used only when
|
||||
doing ROR-index_merge selects
|
||||
*/
|
||||
byte *last_rowid;
|
||||
|
||||
/*
|
||||
Table record buffer used by this quick select.
|
||||
Table record buffer used by this quick select.
|
||||
*/
|
||||
byte *record;
|
||||
#ifndef DBUG_OFF
|
||||
/*
|
||||
Print quick select information to DBUG_FILE. Caller is responsible
|
||||
Print quick select information to DBUG_FILE. Caller is responsible
|
||||
for locking DBUG_FILE before this call and unlocking it afterwards.
|
||||
*/
|
||||
virtual void dbug_dump(int indent, bool verbose)= 0;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -218,7 +218,7 @@ struct st_qsel_param;
|
||||
class SEL_ARG;
|
||||
|
||||
/*
|
||||
Quick select that does a range scan on a single key. The records are
|
||||
Quick select that does a range scan on a single key. The records are
|
||||
returned in key order.
|
||||
*/
|
||||
class QUICK_RANGE_SELECT : public QUICK_SELECT_I
|
||||
@ -237,7 +237,7 @@ protected:
|
||||
|
||||
protected:
|
||||
friend
|
||||
QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
|
||||
QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
|
||||
struct st_table_ref *ref);
|
||||
friend bool get_quick_keys(struct st_qsel_param *param,
|
||||
QUICK_RANGE_SELECT *quick,KEY_PART *key,
|
||||
@ -255,7 +255,7 @@ protected:
|
||||
QUICK_RANGE **cur_range; /* current element in ranges */
|
||||
|
||||
QUICK_RANGE *range;
|
||||
KEY_PART *key_parts;
|
||||
KEY_PART *key_parts;
|
||||
KEY_PART_INFO *key_part_info;
|
||||
int cmp_next(QUICK_RANGE *range);
|
||||
int cmp_prev(QUICK_RANGE *range);
|
||||
@ -266,11 +266,11 @@ public:
|
||||
QUICK_RANGE_SELECT(THD *thd, TABLE *table,uint index_arg,bool no_alloc=0,
|
||||
MEM_ROOT *parent_alloc=NULL);
|
||||
~QUICK_RANGE_SELECT();
|
||||
|
||||
|
||||
int reset(void)
|
||||
{
|
||||
next=0;
|
||||
range= NULL;
|
||||
next=0;
|
||||
range= NULL;
|
||||
cur_range= NULL;
|
||||
return 0;
|
||||
}
|
||||
@ -308,29 +308,29 @@ public:
|
||||
/*
|
||||
QUICK_INDEX_MERGE_SELECT - index_merge access method quick select.
|
||||
|
||||
QUICK_INDEX_MERGE_SELECT uses
|
||||
QUICK_INDEX_MERGE_SELECT uses
|
||||
* QUICK_RANGE_SELECTs to get rows
|
||||
* Unique class to remove duplicate rows
|
||||
|
||||
INDEX MERGE OPTIMIZER
|
||||
Current implementation doesn't detect all cases where index_merge could
|
||||
Current implementation doesn't detect all cases where index_merge could
|
||||
be used, in particular:
|
||||
* index_merge will never be used if range scan is possible (even if
|
||||
* index_merge will never be used if range scan is possible (even if
|
||||
range scan is more expensive)
|
||||
|
||||
* index_merge+'using index' is not supported (this the consequence of
|
||||
* index_merge+'using index' is not supported (this the consequence of
|
||||
the above restriction)
|
||||
|
||||
|
||||
* If WHERE part contains complex nested AND and OR conditions, some ways
|
||||
to retrieve rows using index_merge will not be considered. The choice
|
||||
of read plan may depend on the order of conjuncts/disjuncts in WHERE
|
||||
to retrieve rows using index_merge will not be considered. The choice
|
||||
of read plan may depend on the order of conjuncts/disjuncts in WHERE
|
||||
part of the query, see comments near imerge_list_or_list and
|
||||
SEL_IMERGE::or_sel_tree_with_checks functions for details.
|
||||
|
||||
* There is no "index_merge_ref" method (but index_merge on non-first
|
||||
table in join is possible with 'range checked for each record').
|
||||
|
||||
See comments around SEL_IMERGE class and test_quick_select for more
|
||||
See comments around SEL_IMERGE class and test_quick_select for more
|
||||
details.
|
||||
|
||||
ROW RETRIEVAL ALGORITHM
|
||||
@ -352,7 +352,7 @@ public:
|
||||
}
|
||||
deactivate 'index only';
|
||||
}
|
||||
|
||||
|
||||
Phase 2 (implemented as sequence of QUICK_INDEX_MERGE_SELECT::get_next
|
||||
calls):
|
||||
|
||||
@ -364,7 +364,7 @@ public:
|
||||
}
|
||||
*/
|
||||
|
||||
class QUICK_INDEX_MERGE_SELECT : public QUICK_SELECT_I
|
||||
class QUICK_INDEX_MERGE_SELECT : public QUICK_SELECT_I
|
||||
{
|
||||
public:
|
||||
QUICK_INDEX_MERGE_SELECT(THD *thd, TABLE *table);
|
||||
@ -387,23 +387,23 @@ public:
|
||||
|
||||
/* range quick selects this index_merge read consists of */
|
||||
List<QUICK_RANGE_SELECT> quick_selects;
|
||||
|
||||
|
||||
/* quick select which is currently used for rows retrieval */
|
||||
List_iterator_fast<QUICK_RANGE_SELECT> cur_quick_it;
|
||||
QUICK_RANGE_SELECT* cur_quick_select;
|
||||
|
||||
|
||||
/* quick select that uses clustered primary key (NULL if none) */
|
||||
QUICK_RANGE_SELECT* pk_quick_select;
|
||||
|
||||
|
||||
/* true if this select is currently doing a clustered PK scan */
|
||||
bool doing_pk_scan;
|
||||
|
||||
|
||||
Unique *unique;
|
||||
MEM_ROOT alloc;
|
||||
|
||||
THD *thd;
|
||||
int prepare_unique();
|
||||
|
||||
|
||||
/* used to get rows collected in Unique */
|
||||
READ_RECORD read_record;
|
||||
};
|
||||
@ -411,26 +411,26 @@ public:
|
||||
|
||||
/*
|
||||
Rowid-Ordered Retrieval (ROR) index intersection quick select.
|
||||
This quick select produces intersection of row sequences returned
|
||||
This quick select produces intersection of row sequences returned
|
||||
by several QUICK_RANGE_SELECTs it "merges".
|
||||
|
||||
All merged QUICK_RANGE_SELECTs must return rowids in rowid order.
|
||||
|
||||
All merged QUICK_RANGE_SELECTs must return rowids in rowid order.
|
||||
QUICK_ROR_INTERSECT_SELECT will return rows in rowid order, too.
|
||||
|
||||
All merged quick selects retrieve {rowid, covered_fields} tuples (not full
|
||||
All merged quick selects retrieve {rowid, covered_fields} tuples (not full
|
||||
table records).
|
||||
QUICK_ROR_INTERSECT_SELECT retrieves full records if it is not being used
|
||||
by QUICK_ROR_INTERSECT_SELECT and all merged quick selects together don't
|
||||
QUICK_ROR_INTERSECT_SELECT retrieves full records if it is not being used
|
||||
by QUICK_ROR_INTERSECT_SELECT and all merged quick selects together don't
|
||||
cover needed all fields.
|
||||
|
||||
|
||||
If one of the merged quick selects is a Clustered PK range scan, it is
|
||||
used only to filter rowid sequence produced by other merged quick selects.
|
||||
*/
|
||||
|
||||
class QUICK_ROR_INTERSECT_SELECT : public QUICK_SELECT_I
|
||||
class QUICK_ROR_INTERSECT_SELECT : public QUICK_SELECT_I
|
||||
{
|
||||
public:
|
||||
QUICK_ROR_INTERSECT_SELECT(THD *thd, TABLE *table,
|
||||
QUICK_ROR_INTERSECT_SELECT(THD *thd, TABLE *table,
|
||||
bool retrieve_full_rows,
|
||||
MEM_ROOT *parent_alloc);
|
||||
~QUICK_ROR_INTERSECT_SELECT();
|
||||
@ -450,14 +450,14 @@ public:
|
||||
int init_ror_merged_scan(bool reuse_handler);
|
||||
bool push_quick_back(QUICK_RANGE_SELECT *quick_sel_range);
|
||||
|
||||
/*
|
||||
/*
|
||||
Range quick selects this intersection consists of, not including
|
||||
cpk_quick.
|
||||
*/
|
||||
List<QUICK_RANGE_SELECT> quick_selects;
|
||||
|
||||
/*
|
||||
Merged quick select that uses Clustered PK, if there is one. This quick
|
||||
|
||||
/*
|
||||
Merged quick select that uses Clustered PK, if there is one. This quick
|
||||
select is not used for row retrieval, it is used for row retrieval.
|
||||
*/
|
||||
QUICK_RANGE_SELECT *cpk_quick;
|
||||
@ -473,15 +473,15 @@ public:
|
||||
This quick select produces union of row sequences returned by several
|
||||
quick select it "merges".
|
||||
|
||||
All merged quick selects must return rowids in rowid order.
|
||||
All merged quick selects must return rowids in rowid order.
|
||||
QUICK_ROR_UNION_SELECT will return rows in rowid order, too.
|
||||
|
||||
All merged quick selects are set not to retrieve full table records.
|
||||
ROR-union quick select always retrieves full records.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
class QUICK_ROR_UNION_SELECT : public QUICK_SELECT_I
|
||||
class QUICK_ROR_UNION_SELECT : public QUICK_SELECT_I
|
||||
{
|
||||
public:
|
||||
QUICK_ROR_UNION_SELECT(THD *thd, TABLE *table);
|
||||
@ -503,7 +503,7 @@ public:
|
||||
bool push_quick_back(QUICK_SELECT_I *quick_sel_range);
|
||||
|
||||
List<QUICK_SELECT_I> quick_selects; /* Merged quick selects */
|
||||
|
||||
|
||||
QUEUE queue; /* Priority queue for merge operation */
|
||||
MEM_ROOT alloc; /* Memory pool for this and merged quick selects data. */
|
||||
|
||||
@ -511,7 +511,7 @@ public:
|
||||
byte *cur_rowid; /* buffer used in get_next() */
|
||||
byte *prev_rowid; /* rowid of last row returned by get_next() */
|
||||
bool have_prev_rowid; /* true if prev_rowid has valid data */
|
||||
uint rowid_length; /* table rowid length */
|
||||
uint rowid_length; /* table rowid length */
|
||||
private:
|
||||
static int queue_cmp(void *arg, byte *val1, byte *val2);
|
||||
};
|
||||
@ -569,4 +569,6 @@ public:
|
||||
int get_type() { return QS_TYPE_FULLTEXT; }
|
||||
};
|
||||
|
||||
QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
|
||||
struct st_table_ref *ref);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user