1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

MCOL-2178 Merging with 10.4

SELECT_LEX had been moved in THD so changed all references.
        Avoid writing CS decimal scales into MDB decimal fields
            d-only dec attribute. WIP
        Replaced infinidb_vtable with a singleton MIGR.
        Merged with MCOL-2121.
        Added new wsrep include paths needed by UDaF code.
        Removed .vcxproj from Connector code.
This commit is contained in:
Roman Nozdrin
2019-02-19 20:37:44 +03:00
committed by Gagan Goel
parent 2071716ebd
commit 6fd5b2f22d
9 changed files with 335 additions and 359 deletions

View File

@@ -1304,8 +1304,8 @@ uint32_t buildOuterJoin(gp_walk_info& gwi, SELECT_LEX& select_lex)
{
if (gwi.thd->derived_tables_processing)
{
gwi.thd->infinidb_vtable.isUnion = false;
gwi.thd->infinidb_vtable.isUpdateWithDerive = true;
MIGR::infinidb_vtable.isUnion = false;
MIGR::infinidb_vtable.isUpdateWithDerive = true;
return -1;
}
}
@@ -2628,8 +2628,8 @@ void setError(THD* thd, uint32_t errcode, string errmsg)
}
thd->raise_error_printf(errcode, errmsg.c_str());
thd->infinidb_vtable.isNewQuery = true;
thd->infinidb_vtable.override_largeside_estimate = false;
MIGR::infinidb_vtable.isNewQuery = true;
MIGR::infinidb_vtable.override_largeside_estimate = false;
// reset expressionID
if (get_fe_conn_info_ptr() == NULL)
@@ -5556,7 +5556,7 @@ void gp_walk(const Item* item, void* arg)
gwip->hasSubSelect = true;
gwip->subQuery = existsSub;
gwip->ptWorkStack.push(existsSub->transform());
current_thd->infinidb_vtable.isUnion = true; // only temp. bypass the 2nd phase.
current_MIGR::infinidb_vtable.isUnion = true; // only temp. bypass the 2nd phase.
// recover original
gwip->subQuery = orig;
gwip->lastSub = existsSub;
@@ -5913,7 +5913,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) ||
((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI ) ) && gwi.thd->derived_tables_processing)
{
gwi.thd->infinidb_vtable.isUnion = false;
MIGR::infinidb_vtable.isUnion = false;
return -1;
}
@@ -5961,7 +5961,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
// @bug 2123. Override large table estimate if infinidb_ordered hint was used.
// @bug 2404. Always override if the infinidb_ordered_only variable is turned on.
if (gwi.thd->infinidb_vtable.override_largeside_estimate || get_ordered_only(gwi.thd))
if (MIGR::infinidb_vtable.override_largeside_estimate || get_ordered_only(gwi.thd))
csep->overrideLargeSideEstimate(true);
// @bug 5741. Set a flag when in Local PM only query mode
@@ -6047,7 +6047,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
gwi.tbList.push_back(tn);
CalpontSystemCatalog::TableAliasName tan = make_aliastable("", alias, alias);
gwi.tableMap[tan] = make_pair(0, table_ptr);
gwi.thd->infinidb_vtable.isUnion = true; //by-pass the 2nd pass of rnd_init
MIGR::infinidb_vtable.isUnion = true; //by-pass the 2nd pass of rnd_init
}
else if (table_ptr->view)
{
@@ -6118,7 +6118,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
// is_unit_op() give a segv for derived_handler's SELECT_LEX
if (!isUnion && select_lex.master_unit()->is_unit_op())
{
gwi.thd->infinidb_vtable.isUnion = true;
MIGR::infinidb_vtable.isUnion = true;
CalpontSelectExecutionPlan::SelectList unionVec;
SELECT_LEX* select_cursor = select_lex.master_unit()->first_select();
unionSel = true;
@@ -6177,7 +6177,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
csep->distinctUnionNum(distUnionNum);
if (unionVec.empty())
gwi.thd->infinidb_vtable.impossibleWhereOnUnion = true;
MIGR::infinidb_vtable.impossibleWhereOnUnion = true;
}
gwi.clauseType = WHERE;
@@ -6210,8 +6210,8 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
// processing.
if (gwi.thd->derived_tables_processing)
{
gwi.thd->infinidb_vtable.isUnion = false;
gwi.thd->infinidb_vtable.isUpdateWithDerive = true;
MIGR::infinidb_vtable.isUnion = false;
MIGR::infinidb_vtable.isUpdateWithDerive = true;
return -1;
}
@@ -7068,7 +7068,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
SRCP minSc; // min width projected column. for count(*) use
// Group by list. not valid for union main query
if (gwi.thd->infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE && !unionSel)
if (MIGR::infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE && !unionSel)
{
gwi.clauseType = GROUP_BY;
Item* nonSupportItem = NULL;
@@ -7345,14 +7345,14 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
}
}
if (gwi.thd->infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE)
if (MIGR::infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE)
{
SQL_I_List<ORDER> order_list = select_lex.order_list;
ORDER* ordercol = reinterpret_cast<ORDER*>(order_list.first);
string create_query(gwi.thd->infinidb_vtable.create_vtable_query.c_ptr());
string select_query(gwi.thd->infinidb_vtable.select_vtable_query.c_ptr());
string lower_create_query(gwi.thd->infinidb_vtable.create_vtable_query.c_ptr());
string lower_select_query(gwi.thd->infinidb_vtable.select_vtable_query.c_ptr());
string create_query(MIGR::infinidb_vtable.create_vtable_query.c_ptr());
string select_query(MIGR::infinidb_vtable.select_vtable_query.c_ptr());
string lower_create_query(MIGR::infinidb_vtable.create_vtable_query.c_ptr());
string lower_select_query(MIGR::infinidb_vtable.select_vtable_query.c_ptr());
boost::algorithm::to_lower(lower_create_query);
boost::algorithm::to_lower(lower_select_query);
@@ -7923,9 +7923,9 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
}
gwi.thd->infinidb_vtable.create_vtable_query.free();
gwi.thd->infinidb_vtable.create_vtable_query.append(create_query.c_str(), create_query.length());
gwi.thd->infinidb_vtable.vtable_state = THD::INFINIDB_REDO_PHASE1; // redo phase 1
MIGR::infinidb_vtable.create_vtable_query.free();
MIGR::infinidb_vtable.create_vtable_query.append(create_query.c_str(), create_query.length());
MIGR::infinidb_vtable.vtable_state = THD::INFINIDB_REDO_PHASE1; // redo phase 1
// turn off select distinct from post process unless there're post process functions
// on the select list.
@@ -8090,7 +8090,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
if (ord_cols.length() > 0) // has order by
{
gwi.thd->infinidb_vtable.has_order_by = true;
MIGR::infinidb_vtable.has_order_by = true;
csep->hasOrderBy(true);
// To activate LimitedOrderBy
if(isPushdownHand)
@@ -8196,7 +8196,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
// do not set in csep. @bug5096. ignore session limit setting for dml
if ((gwi.thd->variables.select_limit == (uint64_t) - 1 ||
(gwi.thd->variables.select_limit != (uint64_t) - 1 &&
gwi.thd->infinidb_vtable.vtable_state != THD::INFINIDB_CREATE_VTABLE)) &&
MIGR::infinidb_vtable.vtable_state != THD::INFINIDB_CREATE_VTABLE)) &&
!csep->hasOrderBy())
{
csep->limitStart(limitOffset);
@@ -8222,8 +8222,8 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
csep->limitNum((uint64_t) - 2);
}
gwi.thd->infinidb_vtable.select_vtable_query.free();
gwi.thd->infinidb_vtable.select_vtable_query.append(select_query.c_str(), select_query.length());
MIGR::infinidb_vtable.select_vtable_query.free();
MIGR::infinidb_vtable.select_vtable_query.append(select_query.c_str(), select_query.length());
// We don't currently support limit with correlated subquery
if (csep->limitNum() != (uint64_t) - 1 &&
@@ -8319,7 +8319,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
csep->derivedTableList(gwi.derivedTbList);
csep->selectSubList(selectSubList);
csep->subSelectList(gwi.subselectList);
gwi.thd->infinidb_vtable.duplicate_field_name = false;
MIGR::infinidb_vtable.duplicate_field_name = false;
clearStacks(gwi);
return 0;
}
@@ -8603,7 +8603,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
// @bug 2123. Override large table estimate if infinidb_ordered hint was used.
// @bug 2404. Always override if the infinidb_ordered_only variable is turned on.
if (gwi.thd->infinidb_vtable.override_largeside_estimate || get_ordered_only(gwi.thd))
if (MIGR::infinidb_vtable.override_largeside_estimate || get_ordered_only(gwi.thd))
csep->overrideLargeSideEstimate(true);
// @bug 5741. Set a flag when in Local PM only query mode
@@ -8689,7 +8689,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
gwi.tbList.push_back(tn);
CalpontSystemCatalog::TableAliasName tan = make_aliastable("", alias, alias);
gwi.tableMap[tan] = make_pair(0, table_ptr);
// gwi.thd->infinidb_vtable.isUnion = true; //by-pass the 2nd pass of rnd_init
// MIGR::infinidb_vtable.isUnion = true; //by-pass the 2nd pass of rnd_init
}
else if (table_ptr->view)
{
@@ -8786,8 +8786,8 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
// processing.
if (gwi.thd->derived_tables_processing)
{
gwi.thd->infinidb_vtable.isUnion = false;
gwi.thd->infinidb_vtable.isUpdateWithDerive = true;
MIGR::infinidb_vtable.isUnion = false;
MIGR::infinidb_vtable.isUpdateWithDerive = true;
return -1;
}
@@ -9606,7 +9606,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
SRCP minSc; // min width projected column. for count(*) use
// Group by list. not valid for union main query
if (gwi.thd->infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE && !unionSel)
if (MIGR::infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE && !unionSel)
{
gwi.clauseType = GROUP_BY;
Item* nonSupportItem = NULL;
@@ -9885,13 +9885,13 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
// ORDER BY processing starts here
if (gwi.thd->infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE)
if (MIGR::infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE)
{
ORDER* ordercol = reinterpret_cast<ORDER*>(gi.groupByOrder);
string create_query(gwi.thd->infinidb_vtable.create_vtable_query.c_ptr());
string select_query(gwi.thd->infinidb_vtable.select_vtable_query.c_ptr());
string lower_create_query(gwi.thd->infinidb_vtable.create_vtable_query.c_ptr());
string lower_select_query(gwi.thd->infinidb_vtable.select_vtable_query.c_ptr());
string create_query(MIGR::infinidb_vtable.create_vtable_query.c_ptr());
string select_query(MIGR::infinidb_vtable.select_vtable_query.c_ptr());
string lower_create_query(MIGR::infinidb_vtable.create_vtable_query.c_ptr());
string lower_select_query(MIGR::infinidb_vtable.select_vtable_query.c_ptr());
boost::algorithm::to_lower(lower_create_query);
boost::algorithm::to_lower(lower_select_query);
@@ -10219,9 +10219,9 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
}
gwi.thd->infinidb_vtable.create_vtable_query.free();
gwi.thd->infinidb_vtable.create_vtable_query.append(create_query.c_str(), create_query.length());
gwi.thd->infinidb_vtable.vtable_state = THD::INFINIDB_REDO_PHASE1; // redo phase 1
MIGR::infinidb_vtable.create_vtable_query.free();
MIGR::infinidb_vtable.create_vtable_query.append(create_query.c_str(), create_query.length());
MIGR::infinidb_vtable.vtable_state = THD::INFINIDB_REDO_PHASE1; // redo phase 1
// turn off select distinct from post process unless there're post process functions
// on the select list.
@@ -10391,7 +10391,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
if ( gwi.orderByCols.size() ) // has order by
{
gwi.thd->infinidb_vtable.has_order_by = true;
MIGR::infinidb_vtable.has_order_by = true;
csep->hasOrderBy(true);
csep->specHandlerProcessed(true);
}
@@ -10418,8 +10418,9 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
csep->limitStart(((Item_int*)gi.groupByTables->select_lex->offset_limit)->val_int());
}
//gwi.thd->infinidb_vtable.select_vtable_query.free();
//gwi.thd->infinidb_vtable.select_vtable_query.append(select_query.c_str(), select_query.length());
// WIP MCOL-2178
//MIGR::infinidb_vtable.select_vtable_query.free();
//MIGR::infinidb_vtable.select_vtable_query.append(select_query.c_str(), select_query.length());
// We don't currently support limit with correlated subquery
if (csep->limitNum() != (uint64_t) - 1 &&
@@ -10516,7 +10517,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
csep->derivedTableList(gwi.derivedTbList);
csep->selectSubList(selectSubList);
csep->subSelectList(gwi.subselectList);
gwi.thd->infinidb_vtable.duplicate_field_name = false;
MIGR::infinidb_vtable.duplicate_field_name = false;
clearStacks(gwi);
return 0;
}