Commit ae2cdc17 authored by Monty's avatar Monty Committed by Sergei Golubchik

fix comments

parent 8ed5fde3
...@@ -8041,7 +8041,7 @@ void make_leaves_list(THD *thd, List<TABLE_LIST> &list, TABLE_LIST *tables, ...@@ -8041,7 +8041,7 @@ void make_leaves_list(THD *thd, List<TABLE_LIST> &list, TABLE_LIST *tables,
from_clause Top-level list of table references in the FROM clause from_clause Top-level list of table references in the FROM clause
tables Table list (select_lex->table_list) tables Table list (select_lex->table_list)
leaves List of join table leaves list (select_lex->leaf_tables) leaves List of join table leaves list (select_lex->leaf_tables)
refresh It is onle refresh for subquery refresh It is only refresh for subquery
select_insert It is SELECT ... INSERT command select_insert It is SELECT ... INSERT command
full_table_list a parameter to pass to the make_leaves_list function full_table_list a parameter to pass to the make_leaves_list function
......
...@@ -756,12 +756,11 @@ JOIN::prepare(Item ***rref_pointer_array, ...@@ -756,12 +756,11 @@ JOIN::prepare(Item ***rref_pointer_array,
} }
table_count= select_lex->leaf_tables.elements; table_count= select_lex->leaf_tables.elements;
TABLE_LIST *tbl; TABLE_LIST *tbl;
List_iterator_fast<TABLE_LIST> li(select_lex->leaf_tables); List_iterator_fast<TABLE_LIST> li(select_lex->leaf_tables);
while ((tbl= li++)) while ((tbl= li++))
{ {
//table_count++; /* Count the number of tables in the join. */
/* /*
If the query uses implicit grouping where the select list contains both If the query uses implicit grouping where the select list contains both
aggregate functions and non-aggregate fields, any non-aggregated field aggregate functions and non-aggregate fields, any non-aggregated field
...@@ -805,8 +804,9 @@ JOIN::prepare(Item ***rref_pointer_array, ...@@ -805,8 +804,9 @@ JOIN::prepare(Item ***rref_pointer_array,
thd->lex->allow_sum_func|= (nesting_map)1 << select_lex_arg->nest_level; thd->lex->allow_sum_func|= (nesting_map)1 << select_lex_arg->nest_level;
select_lex->having_fix_field= 1; select_lex->having_fix_field= 1;
/* /*
Wrap alone field in HAVING clause in case it will be outer field of subquery Wrap alone field in HAVING clause in case it will be outer field
which need persistent pointer on it, but having could be changed by optimizer of subquery which need persistent pointer on it, but having
could be changed by optimizer
*/ */
if (having->type() == Item::REF_ITEM && if (having->type() == Item::REF_ITEM &&
((Item_ref *)having)->ref_type() == Item_ref::REF) ((Item_ref *)having)->ref_type() == Item_ref::REF)
...@@ -1099,8 +1099,8 @@ JOIN::optimize_inner() ...@@ -1099,8 +1099,8 @@ JOIN::optimize_inner()
before 'optimize' from upper query 'optimize' to allow semijoin before 'optimize' from upper query 'optimize' to allow semijoin
conversion happened (which done in the same way. conversion happened (which done in the same way.
*/ */
if(select_lex->first_cond_optimization && if (select_lex->first_cond_optimization &&
conds && conds->walk(&Item::exists2in_processor, 0, (uchar *)thd)) conds && conds->walk(&Item::exists2in_processor, 0, (uchar *)thd))
DBUG_RETURN(1); DBUG_RETURN(1);
/* /*
TODO: make view to decide if it is possible to write to WHERE directly or make Semi-Joins able to process ON condition if it is possible TODO: make view to decide if it is possible to write to WHERE directly or make Semi-Joins able to process ON condition if it is possible
...@@ -2536,9 +2536,10 @@ void JOIN::exec_inner() ...@@ -2536,9 +2536,10 @@ void JOIN::exec_inner()
} }
/* /*
Evaluate all constant expressions with subqueries in the ORDER/GROUP clauses Evaluate all constant expressions with subqueries in the
to make sure that all subqueries return a single row. The evaluation itself ORDER/GROUP clauses to make sure that all subqueries return a
will trigger an error if that is not the case. single row. The evaluation itself will trigger an error if that is
not the case.
*/ */
if (exec_const_order_group_cond.elements && if (exec_const_order_group_cond.elements &&
!(select_options & SELECT_DESCRIBE)) !(select_options & SELECT_DESCRIBE))
...@@ -2763,7 +2764,6 @@ void JOIN::exec_inner() ...@@ -2763,7 +2764,6 @@ void JOIN::exec_inner()
(curr_join->tmp_all_fields1.elements- (curr_join->tmp_all_fields1.elements-
curr_join->tmp_fields_list1.elements); curr_join->tmp_fields_list1.elements);
if (exec_tmp_table2) if (exec_tmp_table2)
curr_tmp_table= exec_tmp_table2; curr_tmp_table= exec_tmp_table2;
else else
...@@ -2878,7 +2878,6 @@ void JOIN::exec_inner() ...@@ -2878,7 +2878,6 @@ void JOIN::exec_inner()
if (curr_tmp_table->distinct) if (curr_tmp_table->distinct)
curr_join->select_distinct=0; /* Each row is unique */ curr_join->select_distinct=0; /* Each row is unique */
curr_join->join_free(); /* Free quick selects */ curr_join->join_free(); /* Free quick selects */
if (curr_join->select_distinct && ! curr_join->group_list) if (curr_join->select_distinct && ! curr_join->group_list)
...@@ -11880,7 +11879,6 @@ void JOIN::cleanup(bool full) ...@@ -11880,7 +11879,6 @@ void JOIN::cleanup(bool full)
} }
} }
cleaned= true; cleaned= true;
} }
else else
{ {
...@@ -16071,11 +16069,15 @@ void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps) ...@@ -16071,11 +16069,15 @@ void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps)
@param param a description used as input to create the table @param param a description used as input to create the table
@param fields list of items that will be used to define @param fields list of items that will be used to define
column types of the table (also see NOTES) column types of the table (also see NOTES)
@param group TODO document @param group Create an unique key over all group by fields.
This is used to retrive the row during
end_write_group() and update them.
@param distinct should table rows be distinct @param distinct should table rows be distinct
@param save_sum_fields see NOTES @param save_sum_fields see NOTES
@param select_options @param select_options Optiions for how the select is run.
@param rows_limit See sql_priv.h for a list of options.
@param rows_limit Maximum number of rows to insert into the
temporary table
@param table_alias possible name of the temporary table that can @param table_alias possible name of the temporary table that can
be used for name resolving; can be "". be used for name resolving; can be "".
*/ */
...@@ -16375,9 +16377,9 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, ...@@ -16375,9 +16377,9 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
/* /*
If item->marker == 4 then we force create_tmp_field If item->marker == 4 then we force create_tmp_field
to create a 64-bit longs for BIT fields because HEAP to create a 64-bit longs for BIT fields because HEAP
tables can't index BIT fields directly. We do the same tables can't index BIT fields directly. We do the
for distinct, as we want the distinct index to be same for distinct, as we want the distinct index
usable in this case too. to be usable in this case too.
*/ */
item->marker == 4 || param->bit_fields_as_long, item->marker == 4 || param->bit_fields_as_long,
force_copy_fields, force_copy_fields,
...@@ -16397,16 +16399,19 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, ...@@ -16397,16 +16399,19 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
created temporary table is not to be used for subquery created temporary table is not to be used for subquery
materialization. materialization.
The reason is that for subqueries that require materialization as part The reason is that for subqueries that require
of their plan, we create the 'external' temporary table needed for IN materialization as part of their plan, we create the
execution, after the 'internal' temporary table needed for grouping. 'external' temporary table needed for IN execution, after
Since both the external and the internal temporary tables are created the 'internal' temporary table needed for grouping. Since
for the same list of SELECT fields of the subquery, setting both the external and the internal temporary tables are
'result_field' for each invocation of create_tmp_table overrides the created for the same list of SELECT fields of the subquery,
previous value of 'result_field'. setting 'result_field' for each invocation of
create_tmp_table overrides the previous value of
The condition below prevents the creation of the external temp table 'result_field'.
to override the 'result_field' that was set for the internal temp table.
The condition below prevents the creation of the external
temp table to override the 'result_field' that was set for
the internal temp table.
*/ */
if (!agg_item->result_field || !param->materialized_subquery) if (!agg_item->result_field || !param->materialized_subquery)
agg_item->result_field= new_field; agg_item->result_field= new_field;
...@@ -17710,6 +17715,7 @@ Next_select_func setup_end_select_func(JOIN *join) ...@@ -17710,6 +17715,7 @@ Next_select_func setup_end_select_func(JOIN *join)
@retval @retval
-1 if error should be sent -1 if error should be sent
*/ */
static int static int
do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure) do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
{ {
...@@ -17877,12 +17883,14 @@ int rr_sequential_and_unpack(READ_RECORD *info) ...@@ -17877,12 +17883,14 @@ int rr_sequential_and_unpack(READ_RECORD *info)
/* /*
Fill the join buffer with partial records, retrieve all full matches for them Fill the join buffer with partial records, retrieve all full matches for
them
SYNOPSIS SYNOPSIS
sub_select_cache() sub_select_cache()
join pointer to the structure providing all context info for the query join pointer to the structure providing all context info for the
join_tab the first next table of the execution plan to be retrieved query
join_tab the first next table of the execution plan to be retrieved
end_records true when we need to perform final steps of the retrieval end_records true when we need to perform final steps of the retrieval
DESCRIPTION DESCRIPTION
...@@ -21059,8 +21067,9 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, ...@@ -21059,8 +21067,9 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
if (join->pre_sort_join_tab) if (join->pre_sort_join_tab)
{ {
/* /*
we've already been in this function, and stashed away the original access we've already been in this function, and stashed away the
method in join->pre_sort_join_tab, restore it now. original access method in join->pre_sort_join_tab, restore it
now.
*/ */
/* First, restore state of the handler */ /* First, restore state of the handler */
...@@ -22795,11 +22804,11 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array, ...@@ -22795,11 +22804,11 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
if (!suv || !new_field) if (!suv || !new_field)
DBUG_RETURN(true); // Fatal error DBUG_RETURN(true); // Fatal error
/* /*
We are replacing the argument of Item_func_set_user_var We are replacing the argument of Item_func_set_user_var after
after its value has been read. The argument's null_value its value has been read. The argument's null_value should be
should be set by now, so we must set it explicitly for the set by now, so we must set it explicitly for the replacement
replacement argument since the null_value may be read argument since the null_value may be read without any
without any preceding call to val_*(). preceeding call to val_*().
*/ */
new_field->update_null_value(); new_field->update_null_value();
List<Item> list; List<Item> list;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment