Commit fdcd079f authored by yiwenshao's avatar yiwenshao

able to use raw version of debug/try_select_data.cc

parent e06da9f6
...@@ -3,16 +3,17 @@ ...@@ -3,16 +3,17 @@
#oAGG: HOM #oAGG: HOM
#oASHE: ASHE #oASHE: ASHE
[onions for num] [onions for num]
#oDET: DETJOIN DET RND oDET: DETJOIN DET RND
#oOPE: OPEFOREIGN OPE RND oOPE: OPEFOREIGN OPE RND
#oAGG: HOM oAGG: HOM
oASHE: ASHE #oASHE: ASHE
[end] [end]
#####################################################################################
#oSWP: SEARCH #oSWP: SEARCH
#oDET: DETJOIN DET RND #oDET: DETJOIN DET RND
#oOPE: OPEFOREIGN OPE RND #oOPE: OPEFOREIGN OPE RND
[onions for str] [onions for str]
#oDET: DETJOIN DET RND oDET: DETJOIN DET RND
#oOPE: OPEFOREIGN OPE RND oOPE: OPEFOREIGN OPE RND
oSWP: SEARCH oSWP: SEARCH
This diff is collapsed.
...@@ -49,8 +49,8 @@ void rewriteInsertHelper(const Item &i, const FieldMeta &fm, Analysis &a, ...@@ -49,8 +49,8 @@ void rewriteInsertHelper(const Item &i, const FieldMeta &fm, Analysis &a,
ContainerType *const append_list) ContainerType *const append_list)
{ {
std::vector<Item *> l; std::vector<Item *> l;
//这里先做lookup, 找到类以后调用内部的结果, 试试 /*first look up the right class and then use the rewritting function of the specific data type
//对于普通的student操作, 最后调用的是ANON的typical_rewrite_insert_type来进行重写. for table student, the function typical_rewrite_insert_type in ANON is used finally. */
itemTypes.do_rewrite_insert(i, fm, a, &l); itemTypes.do_rewrite_insert(i, fm, a, &l);
for (auto it : l) { for (auto it : l) {
append_list->push_back(it); append_list->push_back(it);
...@@ -406,7 +406,8 @@ class MultiDeleteHandler : public DMLHandler { ...@@ -406,7 +406,8 @@ class MultiDeleteHandler : public DMLHandler {
class SelectHandler : public DMLHandler { class SelectHandler : public DMLHandler {
virtual void gather(Analysis &a, LEX *const lex) virtual void gather(Analysis &a, LEX *const lex)
const{ const{
//处理了选择域, 以及为having等field 设置了rewriteplain, 也就是encset, 不同的洋葱层次需要这个东西. /*process the select field, that is the xxx in select xxx. also setup rewriteplain for fileds
like having. the rewriteplain are encset, which is used in decryption*/
process_select_lex(lex->select_lex, a); process_select_lex(lex->select_lex, a);
} }
...@@ -415,11 +416,12 @@ class SelectHandler : public DMLHandler { ...@@ -415,11 +416,12 @@ class SelectHandler : public DMLHandler {
const{ const{
LEX *const new_lex = copyWithTHD(lex); LEX *const new_lex = copyWithTHD(lex);
//table list rewrite
new_lex->select_lex.top_join_list = new_lex->select_lex.top_join_list =
rewrite_table_list(lex->select_lex.top_join_list, a); rewrite_table_list(lex->select_lex.top_join_list, a);
set_select_lex(new_lex, SELECT_LEX *const select_lex_res = rewrite_select_lex(new_lex->select_lex, a);
rewrite_select_lex(new_lex->select_lex, a)); set_select_lex(new_lex,select_lex_res);
return new DMLQueryExecutor(*new_lex, a.rmeta); return new DMLQueryExecutor(*new_lex, a.rmeta);
} }
...@@ -459,29 +461,34 @@ process_filters_lex(const st_select_lex &select_lex, Analysis &a) ...@@ -459,29 +461,34 @@ process_filters_lex(const st_select_lex &select_lex, Analysis &a)
void void
process_select_lex(const st_select_lex &select_lex, Analysis &a) process_select_lex(const st_select_lex &select_lex, Analysis &a)
{ {
//可以看到, 首先处理top_join_list, 是List<TABLE_LIST>类型. 其含义是join list of the top level. /*select_lex.top_join_list is join list of the top level. The type is List<TABLE_LIST>. internally,
//内部分别用process_table_aliases(tll, a); process_table_joins_and_derived(tll, a);两个函数处理. it uses two functions process_table_aliases(tll, a) and process_table_joins_and_derived(tll, a)
//如果不是jion式的语句, 就不用管了.其内部通过递归处理nested join, 并且处理了*on*语句. to process the list. nested join is processed via recursion. and *on* queries are processed also.
if no join is used in the query, then this function is not used.
*/
process_table_list(select_lex.top_join_list, a); process_table_list(select_lex.top_join_list, a);
//这里处理的是itemlist, 也就是List of columns and expressions: SELECT: Columns and /* process the itemlist, that is: List of columns and expressions: SELECT: Columns and
//expressions in the SELECT list.是List<Item>类型. expressions in the SELECT list. The type is List<Item>.
//select 也就是选择域 */
auto item_it = auto item_it =
RiboldMYSQL::constList_iterator<Item>(select_lex.item_list); RiboldMYSQL::constList_iterator<Item>(select_lex.item_list);
int numOfItem = 0; int numOfItem = 0;
for (;;) { for (;;) {
//因该是对itemlist做内部转化以后在添加rewriteplain. 这里在普通的insert的时候并没有用到. /*not used in normal insert queries;
//这里处理了id 和 name. processes id and name in the table student
*/
const Item *const item = item_it++; const Item *const item = item_it++;
if (!item) if (!item)
break; break;
numOfItem++; numOfItem++;
gatherAndAddAnalysisRewritePlan(*item, a); gatherAndAddAnalysisRewritePlan(*item, a);
} }
//这里处理的是select_lex.where和select_lex.having, 通过Item类型的函数, 也就是下面那个, 为其添加
//rewriteplain. 然后再通过process_order, 对select_lex.group_list和select_lex.order_list添加 /*process select_lex.where and select_lex.having, all of which are of the type Item.
//rewritePlain rewriteplain is added for those items. Also, process_order is used internally to process
select_lex.group_list and select_lex.order_list
*/
process_filters_lex(select_lex, a); process_filters_lex(select_lex, a);
} }
......
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