1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-2178 Fixed MDB crash with setError() operating with empty gwi.

FromSubQuery() is no pushdown aware.

    Actualize OUTER_JOIN_DEBUG section in ha_calpont_execplan.cpp
    to be used with 10.4.

    Enabled derivedTableOptimization() for select handler.
This commit is contained in:
Roman Nozdrin
2019-06-11 00:36:16 +03:00
committed by Gagan Goel
parent 3074b6c4b3
commit a9c72675ba
3 changed files with 46 additions and 47 deletions

View File

@ -11,9 +11,6 @@ ADD_CUSTOM_COMMAND(
set_source_files_properties(ddl-scan.cpp PROPERTIES COMPILE_FLAGS -Wno-sign-compare) set_source_files_properties(ddl-scan.cpp PROPERTIES COMPILE_FLAGS -Wno-sign-compare)
# Parser puts extra info to stderr.
MY_CHECK_AND_SET_COMPILER_FLAG("-DYYDEBUG=1" DEBUG)
########### next target ############### ########### next target ###############
ADD_LIBRARY(ddlpackage SHARED ADD_LIBRARY(ddlpackage SHARED

View File

@ -5399,7 +5399,7 @@ void gp_walk(const Item* item, void* arg)
{ {
vector <Item_field*> fieldVec; vector <Item_field*> fieldVec;
uint16_t parseInfo = 0; uint16_t parseInfo = 0;
parse_item(it, fieldVec, gwip->fatalParseError, parseInfo); parse_item(it, fieldVec, gwip->fatalParseError, parseInfo, gwip);
if (parseInfo & CORRELATED) if (parseInfo & CORRELATED)
{ {
@ -5794,7 +5794,6 @@ void parse_item (Item* item, vector<Item_field*>& field_vec,
for (uint32_t i = 0; i < isp->argument_count(); i++) for (uint32_t i = 0; i < isp->argument_count(); i++)
parse_item(isp->arguments()[i], field_vec, hasNonSupportItem, parseInfo, gwi); parse_item(isp->arguments()[i], field_vec, hasNonSupportItem, parseInfo, gwi);
// parse_item(sfitempp[i], field_vec, hasNonSupportItem, parseInfo);
break; break;
} }
@ -5805,7 +5804,7 @@ void parse_item (Item* item, vector<Item_field*>& field_vec,
Item* cond_item; Item* cond_item;
while ((cond_item = it++)) while ((cond_item = it++))
parse_item(cond_item, field_vec, hasNonSupportItem, parseInfo); parse_item(cond_item, field_vec, hasNonSupportItem, parseInfo, gwi);
break; break;
} }
@ -6086,7 +6085,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
(table_ptr->derived->first_select())->print(gwi.thd, &str, QT_ORDINARY); (table_ptr->derived->first_select())->print(gwi.thd, &str, QT_ORDINARY);
SELECT_LEX* select_cursor = table_ptr->derived->first_select(); SELECT_LEX* select_cursor = table_ptr->derived->first_select();
FromSubQuery fromSub(gwi, select_cursor, isPushdownHand); FromSubQuery fromSub(gwi, select_cursor, false, isPushdownHand);
string alias(table_ptr->alias.str); string alias(table_ptr->alias.str);
fromSub.alias(lower(alias)); fromSub.alias(lower(alias));
@ -6289,62 +6288,63 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
#ifdef OUTER_JOIN_DEBUG #ifdef OUTER_JOIN_DEBUG
List<TABLE_LIST>* tables = &(select_lex.top_join_list); List<TABLE_LIST>* tables = &(select_lex.top_join_list);
List_iterator_fast<TABLE_LIST> ti(*tables); List_iterator_fast<TABLE_LIST> ti(*tables);
//TABLE_LIST *inner;
//TABLE_LIST **table= (TABLE_LIST **)gwi.thd->alloc(sizeof(TABLE_LIST*) * tables->elements);
//for (TABLE_LIST **t= table + (tables->elements - 1); t >= table; t--)
// *t= ti++;
//DBUG_ASSERT(tables->elements >= 1); TABLE_LIST **table= (TABLE_LIST **)gwi.thd->alloc(sizeof(TABLE_LIST*) * tables->elements);
for (TABLE_LIST **t= table + (tables->elements - 1); t >= table; t--)
*t= ti++;
//TABLE_LIST **end= table + tables->elements; DBUG_ASSERT(tables->elements >= 1);
//for (TABLE_LIST **tbl= table; tbl < end; tbl++)
TABLE_LIST* curr;
while ((curr = ti++)) TABLE_LIST **end= table + tables->elements;
for (TABLE_LIST **tbl= table; tbl < end; tbl++)
{ {
TABLE_LIST* curr = *tbl; TABLE_LIST* curr;
if (curr->table_name) while ((curr = ti++))
cerr << curr->table_name << " ";
else
cerr << curr->alias << endl;
if (curr->outer_join)
cerr << " is inner table" << endl;
else if (curr->straight)
cerr << "straight_join" << endl;
else
cerr << "join" << endl;
if (curr->nested_join)
{ {
List<TABLE_LIST>* inners = &(curr->nested_join->join_list); TABLE_LIST* curr = *tbl;
List_iterator_fast<TABLE_LIST> li(*inners);
TABLE_LIST** inner = (TABLE_LIST**)gwi.thd->alloc(sizeof(TABLE_LIST*) * inners->elements);
for (TABLE_LIST** t = inner + (inners->elements - 1); t >= inner; t--) if (curr->table_name.length)
*t = li++; cerr << curr->table_name.str << " ";
else
cerr << curr->alias.str << endl;
TABLE_LIST** end1 = inner + inners->elements; if (curr->outer_join)
cerr << " is inner table" << endl;
else if (curr->straight)
cerr << "straight_join" << endl;
else
cerr << "join" << endl;
for (TABLE_LIST** tb = inner; tb < end1; tb++) if (curr->nested_join)
{ {
TABLE_LIST* curr1 = *tb; List<TABLE_LIST>* inners = &(curr->nested_join->join_list);
cerr << curr1->alias << endl; List_iterator_fast<TABLE_LIST> li(*inners);
TABLE_LIST** inner = (TABLE_LIST**)gwi.thd->alloc(sizeof(TABLE_LIST*) * inners->elements);
if (curr1->sj_on_expr) for (TABLE_LIST** t = inner + (inners->elements - 1); t >= inner; t--)
*t = li++;
TABLE_LIST** end1 = inner + inners->elements;
for (TABLE_LIST** tb = inner; tb < end1; tb++)
{ {
curr1->sj_on_expr->traverse_cond(debug_walk, &gwi, Item::POSTFIX); TABLE_LIST* curr1 = *tb;
cerr << curr1->alias.str << endl;
if (curr1->sj_on_expr)
{
curr1->sj_on_expr->traverse_cond(debug_walk, &gwi, Item::POSTFIX);
}
} }
} }
}
if (curr->sj_on_expr) if (curr->sj_on_expr)
{ {
curr->sj_on_expr->traverse_cond(debug_walk, &gwi, Item::POSTFIX); curr->sj_on_expr->traverse_cond(debug_walk, &gwi, Item::POSTFIX);
}
} }
} }
#endif #endif
uint32_t failed = buildOuterJoin(gwi, select_lex); uint32_t failed = buildOuterJoin(gwi, select_lex);
@ -8137,6 +8137,8 @@ int cs_get_select_plan(select_handler* handler, THD* thd, SCSEP& csep)
cerr << *csep << endl ; cerr << *csep << endl ;
cerr << "-------------- EXECUTION PLAN END --------------\n" << endl; cerr << "-------------- EXECUTION PLAN END --------------\n" << endl;
#endif #endif
// Derived table projection and filter optimization.
derivedTableOptimization(csep);
return 0; return 0;
} }

View File

@ -1757,7 +1757,7 @@ uint32_t doUpdateDelete(THD* thd)
gwi.clauseType = WHERE; gwi.clauseType = WHERE;
if (getSelectPlan(gwi, select_lex, updateCP) != 0) //@Bug 3030 Modify the error message for unsupported functions if (getSelectPlan(gwi, select_lex, updateCP, false, true) != 0) //@Bug 3030 Modify the error message for unsupported functions
{ {
if (MIGR::infinidb_vtable.isUpdateWithDerive) if (MIGR::infinidb_vtable.isUpdateWithDerive)
{ {