Commit e8daa418 authored by Sergei Golubchik's avatar Sergei Golubchik

typos in comments, minor stylistic edits

parent cf50e13f
/* /*
Copyright (c) 2014, SkySQL Ab & MariaDB Foundation Copyright (c) 2014, 2015 SkySQL Ab & MariaDB Foundation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
upper level. upper level.
*/ */
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include "sql_priv.h" #include "sql_priv.h"
#include "sql_select.h" #include "sql_select.h"
...@@ -45,7 +41,7 @@ int group_by_handler::execute(JOIN *join) ...@@ -45,7 +41,7 @@ int group_by_handler::execute(JOIN *join)
ha_rows max_limit; ha_rows max_limit;
ha_rows *reset_limit= 0; ha_rows *reset_limit= 0;
Item **reset_item= 0; Item **reset_item= 0;
DBUG_ENTER("group_by_handler"); DBUG_ENTER("group_by_handler::execute");
if ((err= init_scan())) if ((err= init_scan()))
goto error; goto error;
......
/* /*
Copyright (c) 2014, SkySQL Ab & MariaDB Foundation Copyright (c) 2014, 2015 SkySQL Ab & MariaDB Foundation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
SELECT a,count(*) as sum FROM t1 where b > 10 group by a, order by sum; SELECT a,count(*) as sum FROM t1 where b > 10 group by a, order by sum;
SELECT a,count(*) FROM t1,t2; SELECT a,count(*) FROM t1,t2;
SELECT a, (select sum(*) from t2 where t1.a=t2.a) from t2; SELECT a, (select sum(*) from t2 where t1.a=t2.a) from t2;
See https://mariadb.atlassian.net/browse/MDEV-6080 for more information.
*/ */
class JOIN; class JOIN;
...@@ -46,10 +44,6 @@ public: ...@@ -46,10 +44,6 @@ public:
Item *where, *having; Item *where, *having;
handlerton *ht; /* storage engine of this handler */ handlerton *ht; /* storage engine of this handler */
/*
Bit's of things the storage engine can do for this query.
Should be initialized on object creation.
*/
/* Temporary table where all results should be stored in record[0] */ /* Temporary table where all results should be stored in record[0] */
TABLE *table; TABLE *table;
...@@ -90,6 +84,8 @@ public: ...@@ -90,6 +84,8 @@ public:
} }
/* /*
Bits of things the storage engine can do for this query.
Should be initialized on object creation.
Result data is sorted by the storage engine according to order_by (if it Result data is sorted by the storage engine according to order_by (if it
exists) else according to the group_by. If this is not specified, exists) else according to the group_by. If this is not specified,
MariaDB will store the result set into the temporary table and sort the MariaDB will store the result set into the temporary table and sort the
......
...@@ -1264,7 +1264,7 @@ struct handlerton ...@@ -1264,7 +1264,7 @@ struct handlerton
the summary / group by query. the summary / group by query.
If the storage engine can't do that, return NULL. If the storage engine can't do that, return NULL.
This is only called for SELECT's where all tables are from the same The server guaranteeds that all tables in the list belong to this
storage engine. storage engine.
*/ */
group_by_handler *(*create_group_by)(THD *thd, SELECT_LEX *select_lex, group_by_handler *(*create_group_by)(THD *thd, SELECT_LEX *select_lex,
......
...@@ -760,7 +760,7 @@ JOIN::prepare(Item ***rref_pointer_array, ...@@ -760,7 +760,7 @@ JOIN::prepare(Item ***rref_pointer_array,
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);
/* /*
If all tables comes from the same storage engine, one_storge_engine will If all tables comes from the same storage engine, one_storage_engine will
be set to point to the handlerton of this engine. be set to point to the handlerton of this engine.
*/ */
one_storage_engine= 0; one_storage_engine= 0;
...@@ -1118,7 +1118,8 @@ JOIN::optimize_inner() ...@@ -1118,7 +1118,8 @@ JOIN::optimize_inner()
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
for (TABLE_LIST *tbl= tables_list; tbl; tbl= tbl->next_local) for (TABLE_LIST *tbl= tables_list; tbl; tbl= tbl->next_local)
{ {
if (tbl->on_expr && if (tbl->on_expr &&
...@@ -1969,8 +1970,8 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S ...@@ -1969,8 +1970,8 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
} }
storage_handler_for_group_by->store_data_in_temp_table= need_tmp; storage_handler_for_group_by->store_data_in_temp_table= need_tmp;
/* /*
If there is not specified ORDER BY, we should sort things according If no ORDER BY clause was specified explicitly, we should sort things
to the group_by according to the group_by
*/ */
if (!order) if (!order)
order= group_list; order= group_list;
...@@ -17861,7 +17862,8 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure) ...@@ -17861,7 +17862,8 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
/* Setup HAVING to work with fields in temporary table */ /* Setup HAVING to work with fields in temporary table */
join->set_items_ref_array(join->items1); join->set_items_ref_array(join->items1);
/* The storage engine will take care of the group by query result */ /* The storage engine will take care of the group by query result */
DBUG_RETURN(join->storage_handler_for_group_by->execute(join)); int res= join->storage_handler_for_group_by->execute(join);
DBUG_RETURN(res);
} }
if (table) if (table)
......
...@@ -1011,6 +1011,11 @@ public: ...@@ -1011,6 +1011,11 @@ public:
*/ */
uint top_join_tab_count; uint top_join_tab_count;
uint send_group_parts; uint send_group_parts;
/*
This counts how many times do_select() was invoked for this JOIN.
It's used to restrict Pushdown_query::execute() only to the first
do_select() invocation.
*/
uint do_select_call_count; uint do_select_call_count;
/* /*
True if the query has GROUP BY. True if the query has GROUP BY.
......
...@@ -462,7 +462,7 @@ int ha_seq_group_by_handler::next_row() ...@@ -462,7 +462,7 @@ int ha_seq_group_by_handler::next_row()
List_iterator_fast<Item> it(*fields); List_iterator_fast<Item> it(*fields);
Item_sum *item_sum; Item_sum *item_sum;
Sequence_share *seqs= ((ha_seq*) table_list->table->file)->seqs; Sequence_share *seqs= ((ha_seq*) table_list->table->file)->seqs;
DBUG_ENTER("ha_seq_group_by_handler"); DBUG_ENTER("ha_seq_group_by_handler::next_row");
/* /*
Check if this is the first call to the function. If not, we have already Check if this is the first call to the function. If not, we have already
......
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