You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
chore(plugin): move projection processing into a separate part.
This commit is contained in:
@ -7674,59 +7674,20 @@ void buildInToExistsFilter(gp_walk_info& gwi, SELECT_LEX& select_lex)
|
||||
}
|
||||
}
|
||||
|
||||
/*@brief Translates SELECT_LEX into CSEP */
|
||||
|
||||
/*@brief Process SELECT part of a query or sub-query */
|
||||
/***********************************************************
|
||||
* DESCRIPTION:
|
||||
* This function takes SELECT_LEX and tries to produce
|
||||
* a corresponding CSEP out of it. It is made of parts that
|
||||
* process parts of the query, e.g. FROM, WHERE, SELECT,
|
||||
* HAVING, GROUP BY, ORDER BY. FROM, WHERE, LIMIT are processed
|
||||
* by corresponding methods. CS calls getSelectPlan()
|
||||
* recursively to process subqueries.
|
||||
* ARGS
|
||||
* isUnion if true CS processes UNION unit now
|
||||
* isSelectHandlerTop removes offset at the top of SH query.
|
||||
* Processes SELECT part of a query or sub-query
|
||||
* RETURNS
|
||||
* error id as an int
|
||||
***********************************************************/
|
||||
int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool isUnion,
|
||||
bool isSelectHandlerTop, bool isSelectLexUnit, const std::vector<COND*>& condStack)
|
||||
{
|
||||
#ifdef DEBUG_WALK_COND
|
||||
cerr << "getSelectPlan()" << endl;
|
||||
#endif
|
||||
int rc = 0;
|
||||
// rollup is currently not supported
|
||||
bool withRollup = select_lex.olap == ROLLUP_TYPE;
|
||||
|
||||
setExecutionParams(gwi, csep);
|
||||
|
||||
gwi.subSelectType = csep->subType();
|
||||
uint32_t sessionID = csep->sessionID();
|
||||
gwi.sessionid = sessionID;
|
||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||
csc->identity(CalpontSystemCatalog::FE);
|
||||
csep->timeZone(gwi.timeZone);
|
||||
gwi.csc = csc;
|
||||
|
||||
CalpontSelectExecutionPlan::SelectList derivedTbList;
|
||||
// @bug 1796. Remember table order on the FROM list.
|
||||
gwi.clauseType = FROM;
|
||||
if ((rc = processFrom(isUnion, select_lex, gwi, csep, isSelectHandlerTop, isSelectLexUnit)))
|
||||
int processSelect(SELECT_LEX& select_lex, gp_walk_info& gwi, SCSEP& csep,
|
||||
vector<Item_field*>& funcFieldVec,
|
||||
CalpontSelectExecutionPlan::SelectList& selectSubList)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
gwi.clauseType = WHERE;
|
||||
if ((rc = processWhere(select_lex, gwi, csep, condStack)))
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
gwi.clauseType = SELECT;
|
||||
SELECT_LEX* oldSelectLex = gwi.select_lex; // XXX: SZ: should it be restored in case of error return?
|
||||
gwi.select_lex = &select_lex;
|
||||
#ifdef DEBUG_WALK_COND
|
||||
#ifdef DEBUG_WALK_COND
|
||||
{
|
||||
cerr << "------------------- SELECT --------------------" << endl;
|
||||
List_iterator_fast<Item> it(select_lex.item_list);
|
||||
@ -7739,7 +7700,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
||||
|
||||
cerr << "-----------------------------------------------\n" << endl;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// analyze SELECT and ORDER BY parts - do they have implicit GROUP BY induced by aggregates?
|
||||
{
|
||||
@ -7770,7 +7731,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
||||
// populate returnedcolumnlist and columnmap
|
||||
List_iterator_fast<Item> it(select_lex.item_list);
|
||||
Item* item;
|
||||
vector<Item_field*> funcFieldVec;
|
||||
|
||||
// empty rcWorkStack and ptWorkStack. They should all be empty by now.
|
||||
clearStacks(gwi, false, true);
|
||||
@ -7785,7 +7745,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
||||
scalar->returnedColPos(gwi.additionalRetCols.size());
|
||||
}
|
||||
|
||||
CalpontSelectExecutionPlan::SelectList selectSubList;
|
||||
|
||||
while ((item = it++))
|
||||
{
|
||||
@ -8087,7 +8046,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
||||
return ER_CHECK_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_WALK_COND
|
||||
#ifdef DEBUG_WALK_COND
|
||||
cerr << "SELECT clause SUBSELECT Item: " << sub->substype() << endl;
|
||||
JOIN* join = sub->get_select_lex()->join;
|
||||
|
||||
@ -8100,7 +8059,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
||||
}
|
||||
|
||||
cerr << "Finish SELECT clause subselect item traversing" << endl;
|
||||
#endif
|
||||
#endif
|
||||
SelectSubQuery* selectSub = new SelectSubQuery(gwi, sub);
|
||||
// selectSub->gwip(&gwi);
|
||||
SCSEP ssub = selectSub->transform();
|
||||
@ -8220,6 +8179,67 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@brief Translates SELECT_LEX into CSEP */
|
||||
/***********************************************************
|
||||
* DESCRIPTION:
|
||||
* This function takes SELECT_LEX and tries to produce
|
||||
* a corresponding CSEP out of it. It is made of parts that
|
||||
* process parts of the query, e.g. FROM, WHERE, SELECT,
|
||||
* HAVING, GROUP BY, ORDER BY. FROM, WHERE, LIMIT are processed
|
||||
* by corresponding methods. CS calls getSelectPlan()
|
||||
* recursively to process subqueries.
|
||||
* ARGS
|
||||
* isUnion if true CS processes UNION unit now
|
||||
* isSelectHandlerTop removes offset at the top of SH query.
|
||||
* RETURNS
|
||||
* error id as an int
|
||||
***********************************************************/
|
||||
int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool isUnion,
|
||||
bool isSelectHandlerTop, bool isSelectLexUnit, const std::vector<COND*>& condStack)
|
||||
{
|
||||
#ifdef DEBUG_WALK_COND
|
||||
cerr << "getSelectPlan()" << endl;
|
||||
#endif
|
||||
int rc = 0;
|
||||
// rollup is currently not supported
|
||||
bool withRollup = select_lex.olap == ROLLUP_TYPE;
|
||||
|
||||
setExecutionParams(gwi, csep);
|
||||
|
||||
gwi.subSelectType = csep->subType();
|
||||
uint32_t sessionID = csep->sessionID();
|
||||
gwi.sessionid = sessionID;
|
||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||
csc->identity(CalpontSystemCatalog::FE);
|
||||
csep->timeZone(gwi.timeZone);
|
||||
gwi.csc = csc;
|
||||
|
||||
CalpontSelectExecutionPlan::SelectList derivedTbList;
|
||||
// @bug 1796. Remember table order on the FROM list.
|
||||
gwi.clauseType = FROM;
|
||||
if ((rc = processFrom(isUnion, select_lex, gwi, csep, isSelectHandlerTop, isSelectLexUnit)))
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
gwi.clauseType = WHERE;
|
||||
if ((rc = processWhere(select_lex, gwi, csep, condStack)))
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
gwi.clauseType = SELECT;
|
||||
SELECT_LEX* originalSelectLex = gwi.select_lex; // XXX: SZ: should it be restored in case of error return?
|
||||
vector<Item_field*> funcFieldVec;
|
||||
CalpontSelectExecutionPlan::SelectList selectSubList;
|
||||
|
||||
if ((rc = processSelect(select_lex, gwi, csep, funcFieldVec, selectSubList)))
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Having clause handling
|
||||
gwi.clauseType = HAVING;
|
||||
@ -8994,7 +9014,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
||||
for (uint32_t i = 0; i < gwi.localCols.size(); i++)
|
||||
gwi.localCols[i]->sequence(i);
|
||||
|
||||
gwi.select_lex = oldSelectLex;
|
||||
gwi.select_lex = originalSelectLex;
|
||||
// append additionalRetCols to returnedCols
|
||||
gwi.returnedCols.insert(gwi.returnedCols.begin(), gwi.additionalRetCols.begin(),
|
||||
gwi.additionalRetCols.end());
|
||||
|
Reference in New Issue
Block a user