Drizzled Public API Documentation

drizzled::Join Class Reference
Inheritance diagram for drizzled::Join:
drizzled::memory::SqlAlloc

Public Member Functions

 Join (Session *session_arg, List< Item > &fields_arg, uint64_t select_options_arg, select_result *result_arg)
void reset (Session *session_arg, List< Item > &fields_arg, uint64_t select_options_arg, select_result *result_arg)
int prepare (Item ***rref_pointer_array, TableList *tables, uint32_t wind_num, COND *conds, uint32_t og_num, Order *order, Order *group, Item *having, Select_Lex *select, Select_Lex_Unit *unit)
int optimize ()
int reinit ()
void exec ()
int destroy ()
void restore_tmp ()
bool alloc_func_list ()
bool setup_subquery_materialization ()
bool make_sum_func_list (List< Item > &all_fields, List< Item > &send_fields, bool before_group_by, bool recompute=false)
void set_items_ref_array (Item **ptr)
void init_items_ref_array ()
bool rollup_init ()
bool rollup_make_fields (List< Item > &all_fields, List< Item > &fields, Item_sum ***func)
int rollup_send_data (uint32_t idx)
int rollup_write_data (uint32_t idx, Table *table)
void remove_subq_pushed_predicates (Item **where)
void join_free ()
void cleanup (bool full)
void clear ()
void save_join_tab ()
void init_save_join_tab ()
 Save the original join layout.
bool send_row_on_empty_set ()
bool change_result (select_result *result)
bool is_top_level_join () const
void copyPartialPlanIntoOptimalPlan (uint32_t size)
void cache_const_exprs ()
optimizer::PositiongetPosFromOptimalPlan (uint32_t index)
optimizer::PositiongetPosFromPartialPlan (uint32_t index)
void setPosInPartialPlan (uint32_t index, optimizer::Position &in_pos)
optimizer::PositiongetFirstPosInPartialPlan ()
optimizer::PositiongetSpecificPosInPartialPlan (int32_t index)

Static Public Member Functions

static void * operator new (size_t size)
static void * operator new (size_t size, Root &root)
static void * operator new (size_t size, Root *root)
static void * operator new[] (size_t size)
static void * operator new[] (size_t size, Root &root)
static void * operator new[] (size_t size, Root *root)
static void operator delete (void *)
static void operator delete (void *, Root &)
static void operator delete (void *, Root *)
static void operator delete[] (void *)
static void operator delete[] (void *, Root &)
static void operator delete[] (void *, Root *)

Public Attributes

JoinTablejoin_tab
JoinTable ** best_ref
JoinTable ** map2table
JoinTablejoin_tab_save
Table ** table
Table ** all_tables
Tablesort_by_table
uint32_t tables
uint32_t outer_tables
uint32_t const_tables
uint32_t send_group_parts
bool sort_and_group
bool first_record
bool full_join
bool group
bool no_field_update
bool do_send_rows
bool resume_nested_loop
bool no_const_tables
bool select_distinct
bool group_optimized_away
bool simple_order
bool simple_group
bool no_order
bool skip_sort_order
bool union_part
bool optimized
bool need_tmp
bool hidden_group_fields
table_map const_table_map
table_map found_const_table_map
table_map outer_join
ha_rows send_records
ha_rows found_records
ha_rows examined_rows
ha_rows row_limit
ha_rows select_limit
ha_rows fetch_limit
Sessionsession
List< Item > * fields
List< Item > & fields_list
List< TableList > * join_list
Select_Lex_Unit * unit
Select_Lex * select_lex
optimizer::SqlSelectselect
std::bitset< 64 > cur_embedding_map
double best_read
List< Cached_itemgroup_fields
List< Cached_itemgroup_fields_cache
Tabletmp_table
Tableexec_tmp_table1
Tableexec_tmp_table2
Item_sum ** sum_funcs
Item_sum *** sum_funcs_end
Item_sum ** sum_funcs2
Item_sum *** sum_funcs_end2
Itemhaving
Itemtmp_having
Itemhaving_history
uint64_t select_options
select_resultresult
Tmp_Table_Param tmp_table_param
DrizzleLocklock
Jointmp_join
Rollup rollup
DYNAMIC_ARRAY keyuse
Item::cond_result cond_value
Item::cond_result having_value
List< Itemall_fields
List< Itemtmp_all_fields1
List< Itemtmp_all_fields2
List< Itemtmp_all_fields3
List< Itemtmp_fields_list1
List< Itemtmp_fields_list2
List< Itemtmp_fields_list3
int error
Orderorder
Ordergroup_list
CONDconds
Itemconds_history
TableListtables_list
COND_EQUALcond_equal
JoinTablereturn_tab
Item ** ref_pointer_array
Item ** items0
Item ** items1
Item ** items2
Item ** items3
Item ** current_ref_pointer_array
uint32_t ref_pointer_array_size
 size of above in bytes
const char * zero_result_cause
 not 0 if exec must return zero result
SortFieldsortorder
Table ** table_reexec
JoinTablejoin_tab_reexec

Private Attributes

optimizer::Position positions [MAX_TABLES+1]
optimizer::Position best_positions [MAX_TABLES+1]

Detailed Description

Definition at line 37 of file join.h.

Member Function Documentation

void drizzled::Join::copyPartialPlanIntoOptimalPlan ( uint32_t  size)
inline

Copy the partial query plan into the optimal query plan.

Parameters
[in]sizethe size of the plan which is to be copied

Definition at line 308 of file join.h.

References best_positions, and positions.

Referenced by drizzled::best_extension_by_limited_search(), drizzled::make_join_statistics(), and drizzled::optimize_straight_join().

optimizer::Position* drizzled::Join::getFirstPosInPartialPlan ( )
inline
Returns
a pointer to the first position in the partial query plan

Definition at line 348 of file join.h.

References positions.

Referenced by drizzled::make_join_statistics().

optimizer::Position& drizzled::Join::getPosFromOptimalPlan ( uint32_t  index)
inline
Parameters
[in]indexthe index of the position to retrieve
Returns
a reference to the specified position in the optimal query plan

Definition at line 321 of file join.h.

References best_positions.

Referenced by drizzled::get_best_combination(), drizzled::greedy_search(), and drizzled::test_if_skip_sort_order().

optimizer::Position& drizzled::Join::getPosFromPartialPlan ( uint32_t  index)
inline
Parameters
[in]indexthe index of the position to retrieve
Returns
a reference to the specified position in the partial query plan

Definition at line 331 of file join.h.

References positions.

Referenced by drizzled::best_extension_by_limited_search(), drizzled::greedy_search(), and drizzled::optimize_straight_join().

optimizer::Position* drizzled::Join::getSpecificPosInPartialPlan ( int32_t  index)
inline
Parameters
[in]indexthe index of the operator to retrieve from the partial query plan
Returns
a pointer to the position in the partial query plan

Definition at line 358 of file join.h.

References positions.

Referenced by drizzled::make_join_statistics().

void drizzled::Join::setPosInPartialPlan ( uint32_t  index,
optimizer::Position in_pos 
)
inline
Parameters
[in]indexthe index of the position to set
[in]in_posthe value to set the position to

Definition at line 340 of file join.h.

References positions.

Referenced by drizzled::best_access_path(), drizzled::greedy_search(), and drizzled::set_position().

Member Data Documentation

List<Item> drizzled::Join::all_fields

to store all fields that used in query

Definition at line 184 of file join.h.

Referenced by exec(), optimize(), prepare(), reset(), and rollup_init().

optimizer::Position drizzled::Join::best_positions[MAX_TABLES+1]
private

Contains the optimal query execution plan after cost-based optimization has taken place.

Definition at line 49 of file join.h.

Referenced by copyPartialPlanIntoOptimalPlan(), and getPosFromOptimalPlan().

double drizzled::Join::best_read

The cost for the final query execution plan chosen after optimization has completed. The QEP is stored in the best_positions variable.

Definition at line 159 of file join.h.

Referenced by drizzled::best_extension_by_limited_search(), drizzled::choose_plan(), drizzled::greedy_search(), drizzled::make_join_statistics(), optimize(), and drizzled::optimize_straight_join().

Item* drizzled::Join::conds_history

store WHERE for explain

Definition at line 198 of file join.h.

Referenced by drizzled::select_query().

std::bitset<64> drizzled::Join::cur_embedding_map

Bitmap of nested joins embedding the position at the end of the current partial join (valid only during join optimizer run).

Definition at line 153 of file join.h.

Referenced by drizzled::check_interleaving_with_nj(), drizzled::choose_plan(), and drizzled::restore_prev_nj_state().

Table* drizzled::Join::exec_tmp_table1

used to store 2 possible tmp table of SELECT

Definition at line 164 of file join.h.

Referenced by destroy(), exec(), optimize(), and reset().

ha_rows drizzled::Join::fetch_limit

Used to fetch no more than given amount of rows per one fetch operation of server side cursor. The value is checked in end_send and end_send_group in fashion, similar to offset_limit_cnt:

  • fetch_limit= HA_POS_ERROR if there is no cursor.
  • when we open a cursor, we set fetch_limit to 0,
  • on each fetch iteration we add num_rows to fetch to fetch_limit

Definition at line 137 of file join.h.

Referenced by reset().

List<Item>& drizzled::Join::fields_list

hold field list passed to select_query

Definition at line 141 of file join.h.

Referenced by drizzled::add_group_and_distinct_keys(), alloc_func_list(), change_result(), exec(), Join(), optimize(), prepare(), reset(), and rollup_init().

Order* drizzled::Join::group_list
bool drizzled::Join::group_optimized_away

If we have the GROUP BY statement in the query, but the group_list was emptied by optimizer, this flag is true. It happens when fields in the GROUP BY are from constant table

Definition at line 98 of file join.h.

Referenced by optimize(), and reset().

Item* drizzled::Join::having_history

Store having for explain

Definition at line 173 of file join.h.

Referenced by reset(), and drizzled::select_query().

Item** drizzled::Join::items0

Copy of above to be used with different lists

Definition at line 204 of file join.h.

Referenced by exec(), and reset().

List<TableList>* drizzled::Join::join_list

list of joined tables in reverse order

Definition at line 142 of file join.h.

Referenced by drizzled::choose_plan(), optimize(), prepare(), reset(), and drizzled::update_ref_and_keys().

JoinTable* drizzled::Join::join_tab_save

saved join_tab for subquery reexecution

Definition at line 55 of file join.h.

Referenced by reset().

JoinTable** drizzled::Join::map2table

mapping between table indexes and JoinTables

Definition at line 54 of file join.h.

Referenced by drizzled::get_best_combination(), drizzled::make_join_statistics(), optimize(), reset(), and drizzled::update_depend_map().

bool drizzled::Join::no_const_tables

true <=> optimizer must not mark any table as a constant table. This is needed for subqueries in form "a IN (SELECT .. UNION SELECT ..): when we optimize the select that reads the results of the union from a temporary table, we must not mark the temp. table as constant because the number of rows in it may vary from one subquery execution to another.

Definition at line 89 of file join.h.

Referenced by drizzled::make_join_statistics(), and reset().

bool drizzled::Join::no_order

Is set only in case if we have a GROUP BY clause and no ORDER BY after constant elimination of 'order'.

Definition at line 111 of file join.h.

Referenced by exec(), optimize(), and reset().

bool drizzled::Join::optimized

flag to avoid double optimization in EXPLAIN

Definition at line 115 of file join.h.

Referenced by optimize(), prepare(), and reset().

uint32_t drizzled::Join::outer_tables

Number of tables that are not inside semijoin

Definition at line 67 of file join.h.

Referenced by reset().

optimizer::Position drizzled::Join::positions[MAX_TABLES+1]
private

Contains a partial query execution plan which is extended during cost-based optimization.

Definition at line 43 of file join.h.

Referenced by copyPartialPlanIntoOptimalPlan(), getFirstPosInPartialPlan(), getPosFromPartialPlan(), getSpecificPosInPartialPlan(), and setPosInPartialPlan().

Item** drizzled::Join::ref_pointer_array

used pointer reference for this select

Definition at line 202 of file join.h.

Referenced by exec(), prepare(), reset(), rollup_send_data(), and rollup_write_data().

bool drizzled::Join::resume_nested_loop

true when we want to resume nested loop iterations when fetching data from a cursor

Definition at line 81 of file join.h.

Referenced by reset(), and drizzled::sub_select().

JoinTable* drizzled::Join::return_tab

used only for outer joins

Definition at line 201 of file join.h.

Referenced by drizzled::evaluate_join_record(), drizzled::evaluate_null_complemented_join_record(), reset(), and drizzled::sub_select().

Rollup drizzled::Join::rollup
optimizer::SqlSelect* drizzled::Join::select

created in optimization phase

Definition at line 147 of file join.h.

Referenced by destroy(), optimize(), and reset().

bool drizzled::Join::select_distinct

Set if SELECT DISTINCT

Definition at line 90 of file join.h.

Referenced by drizzled::add_group_and_distinct_keys(), alloc_func_list(), exec(), Join(), optimize(), and reset().

bool drizzled::Join::skip_sort_order

Is set if we have a GROUP BY and we have ORDER BY on a constant.

Definition at line 113 of file join.h.

Referenced by exec(), optimize(), and reset().

Table* drizzled::Join::sort_by_table

The table which has an index that allows to produce the requried ordering. A special value of 0x1 means that the ordering will be produced by passing 1st non-const table to filesort(). NULL means no such table exists.

Definition at line 64 of file join.h.

Referenced by drizzled::best_access_path(), drizzled::best_extension_by_limited_search(), optimize(), drizzled::optimize_straight_join(), and reset().

Item_sum** drizzled::Join::sum_funcs2

second copy of sumfuncs (for queries with 2 temporary tables

Definition at line 169 of file join.h.

Referenced by exec(), and reset().

TableList* drizzled::Join::tables_list

hold 'tables' parameter of select_query

Definition at line 199 of file join.h.

Referenced by exec(), optimize(), and prepare().

List<Item> drizzled::Join::tmp_all_fields1

Above list changed to use temporary table

Definition at line 186 of file join.h.

Referenced by exec().

List<Item> drizzled::Join::tmp_fields_list1

Part, shared with list above, emulate following list

Definition at line 190 of file join.h.

Referenced by exec().

Item* drizzled::Join::tmp_having

To store having when processed temporary table

Definition at line 172 of file join.h.

Referenced by exec(), optimize(), reset(), and drizzled::select_query().

Join* drizzled::Join::tmp_join

copy of this Join to be used with temporary tables

Definition at line 179 of file join.h.

Referenced by cleanup(), destroy(), exec(), init_save_join_tab(), reset(), and restore_tmp().

bool drizzled::Join::union_part

this subselect is part of union

Definition at line 114 of file join.h.

Referenced by prepare(), and reset().

Select_Lex_Unit* drizzled::Join::unit

unit structure (with global parameters) for this select

Definition at line 144 of file join.h.

Referenced by drizzled::best_access_path(), exec(), optimize(), prepare(), reset(), and drizzled::test_if_skip_sort_order().


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