@@ -756,12 +756,11 @@ JOIN::prepare(Item ***rref_pointer_array,
756
756
}
757
757
758
758
table_count= select_lex->leaf_tables.elements;
759
-
759
+
760
760
TABLE_LIST *tbl;
761
761
List_iterator_fast<TABLE_LIST> li(select_lex->leaf_tables);
762
762
while ((tbl= li++))
763
763
{
764
- //table_count++; /* Count the number of tables in the join. */
765
764
/*
766
765
If the query uses implicit grouping where the select list contains both
767
766
aggregate functions and non-aggregate fields, any non-aggregated field
@@ -805,8 +804,9 @@ JOIN::prepare(Item ***rref_pointer_array,
805
804
thd->lex->allow_sum_func|= (nesting_map)1 << select_lex_arg->nest_level;
806
805
select_lex->having_fix_field= 1;
807
806
/*
808
- Wrap alone field in HAVING clause in case it will be outer field of subquery
809
- which need persistent pointer on it, but having could be changed by optimizer
807
+ Wrap alone field in HAVING clause in case it will be outer field
808
+ of subquery which need persistent pointer on it, but having
809
+ could be changed by optimizer
810
810
*/
811
811
if (having->type() == Item::REF_ITEM &&
812
812
((Item_ref *)having)->ref_type() == Item_ref::REF)
@@ -1099,8 +1099,8 @@ JOIN::optimize_inner()
1099
1099
before 'optimize' from upper query 'optimize' to allow semijoin
1100
1100
conversion happened (which done in the same way.
1101
1101
*/
1102
- if(select_lex->first_cond_optimization &&
1103
- conds && conds->walk(&Item::exists2in_processor, 0, (uchar *)thd))
1102
+ if (select_lex->first_cond_optimization &&
1103
+ conds && conds->walk(&Item::exists2in_processor, 0, (uchar *)thd))
1104
1104
DBUG_RETURN(1);
1105
1105
/*
1106
1106
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
2536
}
2537
2537
2538
2538
/*
2539
- Evaluate all constant expressions with subqueries in the ORDER/GROUP clauses
2540
- to make sure that all subqueries return a single row. The evaluation itself
2541
- will trigger an error if that is not the case.
2539
+ Evaluate all constant expressions with subqueries in the
2540
+ ORDER/GROUP clauses to make sure that all subqueries return a
2541
+ single row. The evaluation itself will trigger an error if that is
2542
+ not the case.
2542
2543
*/
2543
2544
if (exec_const_order_group_cond.elements &&
2544
2545
!(select_options & SELECT_DESCRIBE))
@@ -2763,7 +2764,6 @@ void JOIN::exec_inner()
2763
2764
(curr_join->tmp_all_fields1.elements-
2764
2765
curr_join->tmp_fields_list1.elements);
2765
2766
2766
-
2767
2767
if (exec_tmp_table2)
2768
2768
curr_tmp_table= exec_tmp_table2;
2769
2769
else
@@ -2878,7 +2878,6 @@ void JOIN::exec_inner()
2878
2878
if (curr_tmp_table->distinct)
2879
2879
curr_join->select_distinct=0; /* Each row is unique */
2880
2880
2881
-
2882
2881
curr_join->join_free(); /* Free quick selects */
2883
2882
2884
2883
if (curr_join->select_distinct && ! curr_join->group_list)
@@ -11880,7 +11879,6 @@ void JOIN::cleanup(bool full)
11880
11879
}
11881
11880
}
11882
11881
cleaned= true;
11883
-
11884
11882
}
11885
11883
else
11886
11884
{
@@ -16071,11 +16069,15 @@ void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps)
16071
16069
@param param a description used as input to create the table
16072
16070
@param fields list of items that will be used to define
16073
16071
column types of the table (also see NOTES)
16074
- @param group TODO document
16072
+ @param group Create an unique key over all group by fields.
16073
+ This is used to retrive the row during
16074
+ end_write_group() and update them.
16075
16075
@param distinct should table rows be distinct
16076
16076
@param save_sum_fields see NOTES
16077
- @param select_options
16078
- @param rows_limit
16077
+ @param select_options Optiions for how the select is run.
16078
+ See sql_priv.h for a list of options.
16079
+ @param rows_limit Maximum number of rows to insert into the
16080
+ temporary table
16079
16081
@param table_alias possible name of the temporary table that can
16080
16082
be used for name resolving; can be "".
16081
16083
*/
@@ -16375,9 +16377,9 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
16375
16377
/*
16376
16378
If item->marker == 4 then we force create_tmp_field
16377
16379
to create a 64-bit longs for BIT fields because HEAP
16378
- tables can't index BIT fields directly. We do the same
16379
- for distinct, as we want the distinct index to be
16380
- usable in this case too.
16380
+ tables can't index BIT fields directly. We do the
16381
+ same for distinct, as we want the distinct index
16382
+ to be usable in this case too.
16381
16383
*/
16382
16384
item->marker == 4 || param->bit_fields_as_long,
16383
16385
force_copy_fields,
@@ -16397,16 +16399,19 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
16397
16399
created temporary table is not to be used for subquery
16398
16400
materialization.
16399
16401
16400
- The reason is that for subqueries that require materialization as part
16401
- of their plan, we create the 'external' temporary table needed for IN
16402
- execution, after the 'internal' temporary table needed for grouping.
16403
- Since both the external and the internal temporary tables are created
16404
- for the same list of SELECT fields of the subquery, setting
16405
- 'result_field' for each invocation of create_tmp_table overrides the
16406
- previous value of 'result_field'.
16407
-
16408
- The condition below prevents the creation of the external temp table
16409
- to override the 'result_field' that was set for the internal temp table.
16402
+ The reason is that for subqueries that require
16403
+ materialization as part of their plan, we create the
16404
+ 'external' temporary table needed for IN execution, after
16405
+ the 'internal' temporary table needed for grouping. Since
16406
+ both the external and the internal temporary tables are
16407
+ created for the same list of SELECT fields of the subquery,
16408
+ setting 'result_field' for each invocation of
16409
+ create_tmp_table overrides the previous value of
16410
+ 'result_field'.
16411
+
16412
+ The condition below prevents the creation of the external
16413
+ temp table to override the 'result_field' that was set for
16414
+ the internal temp table.
16410
16415
*/
16411
16416
if (!agg_item->result_field || !param->materialized_subquery)
16412
16417
agg_item->result_field= new_field;
@@ -17710,6 +17715,7 @@ Next_select_func setup_end_select_func(JOIN *join)
17710
17715
@retval
17711
17716
-1 if error should be sent
17712
17717
*/
17718
+
17713
17719
static int
17714
17720
do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
17715
17721
{
@@ -17877,12 +17883,14 @@ int rr_sequential_and_unpack(READ_RECORD *info)
17877
17883
17878
17884
17879
17885
/*
17880
- Fill the join buffer with partial records, retrieve all full matches for them
17886
+ Fill the join buffer with partial records, retrieve all full matches for
17887
+ them
17881
17888
17882
17889
SYNOPSIS
17883
17890
sub_select_cache()
17884
- join pointer to the structure providing all context info for the query
17885
- join_tab the first next table of the execution plan to be retrieved
17891
+ join pointer to the structure providing all context info for the
17892
+ query
17893
+ join_tab the first next table of the execution plan to be retrieved
17886
17894
end_records true when we need to perform final steps of the retrieval
17887
17895
17888
17896
DESCRIPTION
@@ -21059,8 +21067,9 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
21059
21067
if (join->pre_sort_join_tab)
21060
21068
{
21061
21069
/*
21062
- we've already been in this function, and stashed away the original access
21063
- method in join->pre_sort_join_tab, restore it now.
21070
+ we've already been in this function, and stashed away the
21071
+ original access method in join->pre_sort_join_tab, restore it
21072
+ now.
21064
21073
*/
21065
21074
21066
21075
/* First, restore state of the handler */
@@ -22795,11 +22804,11 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
22795
22804
if (!suv || !new_field)
22796
22805
DBUG_RETURN(true); // Fatal error
22797
22806
/*
22798
- We are replacing the argument of Item_func_set_user_var
22799
- after its value has been read. The argument's null_value
22800
- should be set by now, so we must set it explicitly for the
22801
- replacement argument since the null_value may be read
22802
- without any preceding call to val_*().
22807
+ We are replacing the argument of Item_func_set_user_var after
22808
+ its value has been read. The argument's null_value should be
22809
+ set by now, so we must set it explicitly for the replacement
22810
+ argument since the null_value may be read without any
22811
+ preceeding call to val_*().
22803
22812
*/
22804
22813
new_field->update_null_value();
22805
22814
List<Item> list;
0 commit comments