MySQL 9.1.0
Source Code Documentation
SEL_ARG Class Reference

#include <tree.h>

Public Types

enum  leaf_color { BLACK , RED }
 

Public Member Functions

bool maybe_null () const
 
SEL_ROOTrelease_next_key_part ()
 Convenience function for removing the next_key_part. More...
 
void set_next_key_part (SEL_ROOT *next_key_part_arg)
 Convenience function for changing next_key_part, including updating the use_count. More...
 
 SEL_ARG ()=default
 
 SEL_ARG (SEL_ARG &)
 
 SEL_ARG (Field *, const uchar *, const uchar *, bool asc)
 
 SEL_ARG (Field *field, uint8 part, uchar *min_value, uchar *max_value, uint8 min_flag, uint8 max_flag, bool maybe_flag, bool asc, ha_rkey_function gis_flag)
 
 ~SEL_ARG ()
 Note that almost all SEL_ARGs are created on the MEM_ROOT, so this destructor will only rarely be called. More...
 
bool is_same (const SEL_ARG *arg) const
 returns true if a range predicate is equal. More...
 
void merge_flags (SEL_ARG *arg)
 
void maybe_smaller ()
 
bool is_null_interval ()
 
int cmp_min_to_min (const SEL_ARG *arg) const
 
int cmp_min_to_max (const SEL_ARG *arg) const
 
int cmp_max_to_max (const SEL_ARG *arg) const
 
int cmp_max_to_min (const SEL_ARG *arg) const
 
SEL_ARGclone_and (SEL_ARG *arg, MEM_ROOT *mem_root)
 
SEL_ARGclone_first (SEL_ARG *arg, MEM_ROOT *mem_root)
 
SEL_ARGclone_last (SEL_ARG *arg, MEM_ROOT *mem_root)
 
SEL_ARGclone (RANGE_OPT_PARAM *param, SEL_ARG *new_parent, SEL_ARG **next)
 
bool copy_min (SEL_ARG *arg)
 
bool copy_max (SEL_ARG *arg)
 
void copy_min_to_min (SEL_ARG *arg)
 
void copy_min_to_max (SEL_ARG *arg)
 
void copy_max_to_min (SEL_ARG *arg)
 
void set_gis_index_read_function (const enum ha_rkey_function rkey_func)
 Set spatial index range scan parameters. More...
 
int store_min_value (uint length, uchar **min_key, uint min_key_flag)
 
int store_max_value (uint length, uchar **max_key, uint max_key_flag)
 
void store_min_max_values (uint length, uchar **min_key, uint min_flag, uchar **max_key, uint max_flag, int *min_part, int *max_part)
 Helper function for storing min/max values of SEL_ARG taking into account key part's order. More...
 
void store_next_min_max_keys (KEY_PART *key, uchar **cur_min_key, uint *cur_min_flag, uchar **cur_max_key, uint *cur_max_flag, int *min_part, int *max_part)
 Helper function for storing min/max keys of next SEL_ARG taking into account key part's order. More...
 
SEL_ARGrb_insert (SEL_ARG *leaf)
 
SEL_ARGfirst ()
 This gives the first SEL_ARG in the interval list, and the minimal element in the red-black tree. More...
 
const SEL_ARGfirst () const
 
SEL_ARGlast ()
 
void make_root ()
 
SEL_ARG ** parent_ptr ()
 
bool is_singlepoint () const
 
uint get_min_flag ()
 Return correct min_flag. More...
 
uint get_max_flag ()
 Return correct max_flag. More...
 

Public Attributes

uint8 min_flag {0}
 
uint8 max_flag {0}
 
bool maybe_flag {false}
 maybe_flag signals that this range is AND-ed with some unknown range (a MAYBE_KEY node). More...
 
uint8 part {0}
 
enum ha_rkey_function rkey_func_flag
 The rtree index interval to scan, undefined unless SEL_ARG::min_flag == GEOM_FLAG. More...
 
Fieldfield {nullptr}
 
ucharmin_value
 
ucharmax_value
 
SEL_ARGleft
 
SEL_ARGright
 
SEL_ARGnext
 
SEL_ARGprev
 
SEL_ARGparent {nullptr}
 
SEL_ROOTnext_key_part {nullptr}
 
enum SEL_ARG::leaf_color color
 
bool is_ascending {true}
 true - ASC order, false - DESC More...
 

Friends

SEL_ARGrb_delete_fixup (SEL_ARG *root, SEL_ARG *key, SEL_ARG *par)
 
int test_rb_tree (SEL_ARG *element, SEL_ARG *parent)
 

Member Enumeration Documentation

◆ leaf_color

Enumerator
BLACK 
RED 

Constructor & Destructor Documentation

◆ SEL_ARG() [1/4]

SEL_ARG::SEL_ARG ( )
default

◆ SEL_ARG() [2/4]

SEL_ARG::SEL_ARG ( SEL_ARG arg)

◆ SEL_ARG() [3/4]

SEL_ARG::SEL_ARG ( Field f,
const uchar min_value_arg,
const uchar max_value_arg,
bool  asc 
)

◆ SEL_ARG() [4/4]

SEL_ARG::SEL_ARG ( Field field,
uint8  part,
uchar min_value,
uchar max_value,
uint8  min_flag,
uint8  max_flag,
bool  maybe_flag,
bool  asc,
ha_rkey_function  gis_flag 
)

◆ ~SEL_ARG()

SEL_ARG::~SEL_ARG ( )
inline

Note that almost all SEL_ARGs are created on the MEM_ROOT, so this destructor will only rarely be called.

Member Function Documentation

◆ clone()

SEL_ARG * SEL_ARG::clone ( RANGE_OPT_PARAM param,
SEL_ARG new_parent,
SEL_ARG **  next 
)

◆ clone_and()

SEL_ARG * SEL_ARG::clone_and ( SEL_ARG arg,
MEM_ROOT mem_root 
)
inline

◆ clone_first()

SEL_ARG * SEL_ARG::clone_first ( SEL_ARG arg,
MEM_ROOT mem_root 
)
inline

◆ clone_last()

SEL_ARG * SEL_ARG::clone_last ( SEL_ARG arg,
MEM_ROOT mem_root 
)
inline

◆ cmp_max_to_max()

int SEL_ARG::cmp_max_to_max ( const SEL_ARG arg) const
inline

◆ cmp_max_to_min()

int SEL_ARG::cmp_max_to_min ( const SEL_ARG arg) const
inline

◆ cmp_min_to_max()

int SEL_ARG::cmp_min_to_max ( const SEL_ARG arg) const
inline

◆ cmp_min_to_min()

int SEL_ARG::cmp_min_to_min ( const SEL_ARG arg) const
inline

◆ copy_max()

bool SEL_ARG::copy_max ( SEL_ARG arg)
inline

◆ copy_max_to_min()

void SEL_ARG::copy_max_to_min ( SEL_ARG arg)
inline

◆ copy_min()

bool SEL_ARG::copy_min ( SEL_ARG arg)
inline

◆ copy_min_to_max()

void SEL_ARG::copy_min_to_max ( SEL_ARG arg)
inline

◆ copy_min_to_min()

void SEL_ARG::copy_min_to_min ( SEL_ARG arg)
inline

◆ first() [1/2]

SEL_ARG * SEL_ARG::first ( )

This gives the first SEL_ARG in the interval list, and the minimal element in the red-black tree.

Returns
SEL_ARG first SEL_ARG in the interval list

◆ first() [2/2]

const SEL_ARG * SEL_ARG::first ( ) const

◆ get_max_flag()

uint SEL_ARG::get_max_flag ( )
inline

Return correct max_flag.

For DESC key parts min flag should be used as max flag, but in order to be checked correctly, min flag should be flipped as code doesn't expect e.g NEAR_MIN in max flag.

◆ get_min_flag()

uint SEL_ARG::get_min_flag ( )
inline

Return correct min_flag.

For DESC key parts max flag should be used as min flag, but in order to be checked correctly, max flag should be flipped as code doesn't expect e.g NEAR_MAX in min flag.

◆ is_null_interval()

bool SEL_ARG::is_null_interval ( )
inline

◆ is_same()

bool SEL_ARG::is_same ( const SEL_ARG arg) const
inline

returns true if a range predicate is equal.

Use all_same() to check for equality of all the predicates on this keypart.

◆ is_singlepoint()

bool SEL_ARG::is_singlepoint ( ) const
inline

◆ last()

SEL_ARG * SEL_ARG::last ( )

◆ make_root()

void SEL_ARG::make_root ( )
inline

◆ maybe_null()

bool SEL_ARG::maybe_null ( ) const
inline

◆ maybe_smaller()

void SEL_ARG::maybe_smaller ( )
inline

◆ merge_flags()

void SEL_ARG::merge_flags ( SEL_ARG arg)
inline

◆ parent_ptr()

SEL_ARG ** SEL_ARG::parent_ptr ( )
inline

◆ rb_insert()

SEL_ARG * SEL_ARG::rb_insert ( SEL_ARG leaf)

◆ release_next_key_part()

SEL_ROOT * SEL_ARG::release_next_key_part ( )
inline

Convenience function for removing the next_key_part.

The typical use for this function is to disconnect the next_key_part from the root, send it to key_and() or key_or(), and then connect the result of that function back to the SEL_ARG using set_next_key_part().

Returns
The previous value of next_key_part.

◆ set_gis_index_read_function()

void SEL_ARG::set_gis_index_read_function ( const enum ha_rkey_function  rkey_func)
inline

Set spatial index range scan parameters.

This object will be used to do spatial index range scan after this call.

Parameters
rkey_funcThe scan function to perform. It must be one of the spatial index specific scan functions.

◆ set_next_key_part()

void SEL_ARG::set_next_key_part ( SEL_ROOT next_key_part_arg)
inline

Convenience function for changing next_key_part, including updating the use_count.

The argument is allowed to be nullptr.

Parameters
next_key_part_argNew value for next_key_part.

◆ store_max_value()

int SEL_ARG::store_max_value ( uint  length,
uchar **  max_key,
uint  max_key_flag 
)
inline

◆ store_min_max_values()

void SEL_ARG::store_min_max_values ( uint  length,
uchar **  min_key,
uint  min_flag,
uchar **  max_key,
uint  max_flag,
int *  min_part,
int *  max_part 
)
inline

Helper function for storing min/max values of SEL_ARG taking into account key part's order.

◆ store_min_value()

int SEL_ARG::store_min_value ( uint  length,
uchar **  min_key,
uint  min_key_flag 
)
inline

◆ store_next_min_max_keys()

void SEL_ARG::store_next_min_max_keys ( KEY_PART key,
uchar **  cur_min_key,
uint *  cur_min_flag,
uchar **  cur_max_key,
uint *  cur_max_flag,
int *  min_part,
int *  max_part 
)
inline

Helper function for storing min/max keys of next SEL_ARG taking into account key part's order.

Note
On checking min/max flags: Flags are used to track whether there's a partial key in the key buffer. So for ASC key parts the flag corresponding to the key being added to should be checked, not corresponding to the value being added. I.e min_flag for min_key. For DESC key parts it's opposite - max_flag for min_key. It's flag of prev key part that should be checked.

Friends And Related Function Documentation

◆ rb_delete_fixup

SEL_ARG * rb_delete_fixup ( SEL_ARG root,
SEL_ARG key,
SEL_ARG par 
)
friend

◆ test_rb_tree

int test_rb_tree ( SEL_ARG element,
SEL_ARG parent 
)
friend

Member Data Documentation

◆ color

enum SEL_ARG::leaf_color SEL_ARG::color

◆ field

Field* SEL_ARG::field {nullptr}

◆ is_ascending

bool SEL_ARG::is_ascending {true}

true - ASC order, false - DESC

◆ left

SEL_ARG* SEL_ARG::left

◆ max_flag

uint8 SEL_ARG::max_flag {0}

◆ max_value

uchar * SEL_ARG::max_value

◆ maybe_flag

bool SEL_ARG::maybe_flag {false}

maybe_flag signals that this range is AND-ed with some unknown range (a MAYBE_KEY node).

This means that the range could be smaller than what it would otherwise denote; e.g., a range such as

(0 < x < 3) AND x=( SELECT ... )

could in reality be e.g. (1 < x < 2), depending on what the subselect returns (and we don't know that when planning), but it could never be bigger.

FIXME: It's unclear if this is really kept separately per SEL_ARG or is meaningful only at the root node, and thus should be moved to the SEL_ROOT. Most code seems to assume the latter, but a few select places, non-root nodes appear to be modified.

◆ min_flag

uint8 SEL_ARG::min_flag {0}

◆ min_value

uchar* SEL_ARG::min_value

◆ next

SEL_ARG* SEL_ARG::next

◆ next_key_part

SEL_ROOT* SEL_ARG::next_key_part {nullptr}

◆ parent

SEL_ARG* SEL_ARG::parent {nullptr}

◆ part

uint8 SEL_ARG::part {0}

◆ prev

SEL_ARG * SEL_ARG::prev

◆ right

SEL_ARG * SEL_ARG::right

◆ rkey_func_flag

enum ha_rkey_function SEL_ARG::rkey_func_flag

The rtree index interval to scan, undefined unless SEL_ARG::min_flag == GEOM_FLAG.


The documentation for this class was generated from the following files: