1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -17,10 +17,10 @@
MA 02110-1301, USA. */
/***********************************************************************
* $Id: ha_exists_sub.cpp 6426 2010-03-30 18:46:11Z zzhu $
*
*
***********************************************************************/
* $Id: ha_exists_sub.cpp 6426 2010-03-30 18:46:11Z zzhu $
*
*
***********************************************************************/
/** @file */
/** class ExistsSub definition */
@ -47,108 +47,111 @@ extern void makeAntiJoin(const ParseTree* n);
void checkCorrelation(const ParseTree* n, void* obj)
{
ExistsFilter* ef = reinterpret_cast<ExistsFilter*>(obj);
TreeNode* tn = n->data();
SimpleFilter* sf = dynamic_cast<SimpleFilter*>(tn);
ExistsFilter* ef = reinterpret_cast<ExistsFilter*>(obj);
TreeNode* tn = n->data();
SimpleFilter* sf = dynamic_cast<SimpleFilter*>(tn);
if (!sf)
return;
if (!sf)
return;
uint64_t lJoinInfo = sf->lhs()->joinInfo();
uint64_t rJoinInfo = sf->rhs()->joinInfo();
uint64_t lJoinInfo = sf->lhs()->joinInfo();
uint64_t rJoinInfo = sf->rhs()->joinInfo();
if (lJoinInfo & JOIN_CORRELATED)
{
ConstantColumn* cc = dynamic_cast<ConstantColumn*>(sf->rhs());
if (lJoinInfo & JOIN_CORRELATED)
{
ConstantColumn* cc = dynamic_cast<ConstantColumn*>(sf->rhs());
if ((!cc || (cc && sf->op()->op() == OP_EQ)) && !(rJoinInfo & JOIN_CORRELATED))
ef->correlated(true);
}
if ((!cc || (cc && sf->op()->op() == OP_EQ)) && !(rJoinInfo & JOIN_CORRELATED))
ef->correlated(true);
}
if (rJoinInfo & JOIN_CORRELATED)
{
ConstantColumn* cc = dynamic_cast<ConstantColumn*>(sf->lhs());
if (rJoinInfo & JOIN_CORRELATED)
{
ConstantColumn* cc = dynamic_cast<ConstantColumn*>(sf->lhs());
if ((!cc || (cc && sf->op()->op() == OP_EQ)) && !(lJoinInfo & JOIN_CORRELATED))
ef->correlated(true);
}
if ((!cc || (cc && sf->op()->op() == OP_EQ)) && !(lJoinInfo & JOIN_CORRELATED))
ef->correlated(true);
}
}
ExistsSub::ExistsSub(gp_walk_info& gwip) : WhereSubQuery(gwip)
{}
{
}
ExistsSub::ExistsSub(gp_walk_info& gwip, Item_subselect* sub) :
WhereSubQuery(gwip, sub)
{}
ExistsSub::ExistsSub(gp_walk_info& gwip, Item_subselect* sub) : WhereSubQuery(gwip, sub)
{
}
ExistsSub::~ExistsSub()
{}
{
}
execplan::ParseTree* ExistsSub::transform()
{
idbassert(fSub);
idbassert(fSub);
SCSEP csep(new CalpontSelectExecutionPlan());
csep->sessionID(fGwip.sessionid);
csep->location(CalpontSelectExecutionPlan::WHERE);
csep->subType (CalpontSelectExecutionPlan::EXISTS_SUBS);
SCSEP csep(new CalpontSelectExecutionPlan());
csep->sessionID(fGwip.sessionid);
csep->location(CalpontSelectExecutionPlan::WHERE);
csep->subType(CalpontSelectExecutionPlan::EXISTS_SUBS);
// gwi for the sub query
gp_walk_info gwi;
gwi.thd = fGwip.thd;
gwi.subQuery = this;
// gwi for the sub query
gp_walk_info gwi;
gwi.thd = fGwip.thd;
gwi.subQuery = this;
// @4827 merge table list to gwi in case there is FROM sub to be referenced
// in the FROM sub
gwi.derivedTbCnt = fGwip.derivedTbList.size();
uint32_t tbCnt = fGwip.tbList.size();
// @4827 merge table list to gwi in case there is FROM sub to be referenced
// in the FROM sub
gwi.derivedTbCnt = fGwip.derivedTbList.size();
uint32_t tbCnt = fGwip.tbList.size();
gwi.tbList.insert(gwi.tbList.begin(), fGwip.tbList.begin(), fGwip.tbList.end());
gwi.derivedTbList.insert(gwi.derivedTbList.begin(), fGwip.derivedTbList.begin(), fGwip.derivedTbList.end());
gwi.tbList.insert(gwi.tbList.begin(), fGwip.tbList.begin(), fGwip.tbList.end());
gwi.derivedTbList.insert(gwi.derivedTbList.begin(), fGwip.derivedTbList.begin(), fGwip.derivedTbList.end());
if (fSub->get_select_lex()->with_sum_func)
{
fGwip.fatalParseError = true;
fGwip.parseErrorText = logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_AGG_EXISTS);
return NULL;
}
if (fSub->get_select_lex()->with_sum_func)
{
fGwip.fatalParseError = true;
fGwip.parseErrorText = logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_AGG_EXISTS);
return NULL;
}
if (getSelectPlan(gwi, *(fSub->get_select_lex()), csep, false) != 0)
{
fGwip.fatalParseError = true;
if (getSelectPlan(gwi, *(fSub->get_select_lex()), csep, false) != 0)
{
fGwip.fatalParseError = true;
if (gwi.fatalParseError && !gwi.parseErrorText.empty())
fGwip.parseErrorText = gwi.parseErrorText;
else
fGwip.parseErrorText = "Error occured in ExistsSub::transform()";
if (gwi.fatalParseError && !gwi.parseErrorText.empty())
fGwip.parseErrorText = gwi.parseErrorText;
else
fGwip.parseErrorText = "Error occured in ExistsSub::transform()";
return NULL;
}
return NULL;
}
// remove outer query tables
CalpontSelectExecutionPlan::TableList tblist;
// remove outer query tables
CalpontSelectExecutionPlan::TableList tblist;
if (csep->tableList().size() >= tbCnt)
tblist.insert(tblist.begin(), csep->tableList().begin() + tbCnt, csep->tableList().end());
if (csep->tableList().size() >= tbCnt)
tblist.insert(tblist.begin(), csep->tableList().begin() + tbCnt, csep->tableList().end());
CalpontSelectExecutionPlan::SelectList derivedTbList;
CalpontSelectExecutionPlan::SelectList derivedTbList;
if (csep->derivedTableList().size() >= gwi.derivedTbCnt)
derivedTbList.insert(derivedTbList.begin(), csep->derivedTableList().begin() + gwi.derivedTbCnt, csep->derivedTableList().end());
if (csep->derivedTableList().size() >= gwi.derivedTbCnt)
derivedTbList.insert(derivedTbList.begin(), csep->derivedTableList().begin() + gwi.derivedTbCnt,
csep->derivedTableList().end());
csep->tableList(tblist);
csep->derivedTableList(derivedTbList);
csep->tableList(tblist);
csep->derivedTableList(derivedTbList);
ExistsFilter* subFilter = new ExistsFilter();
subFilter->correlated(false);
subFilter->sub(csep);
const ParseTree* pt = csep->filters();
ExistsFilter* subFilter = new ExistsFilter();
subFilter->correlated(false);
subFilter->sub(csep);
const ParseTree* pt = csep->filters();
if (pt)
pt->walk(checkCorrelation, subFilter);
if (pt)
pt->walk(checkCorrelation, subFilter);
fGwip.subselectList.push_back(csep);
return new ParseTree(subFilter);
fGwip.subselectList.push_back(csep);
return new ParseTree(subFilter);
}
/**
@ -158,20 +161,20 @@ execplan::ParseTree* ExistsSub::transform()
*/
void ExistsSub::handleNot()
{
ParseTree* pt = fGwip.ptWorkStack.top();
ExistsFilter* subFilter = dynamic_cast<ExistsFilter*>(pt->data());
idbassert(subFilter);
subFilter->notExists(true);
SCSEP csep = subFilter->sub();
const ParseTree* ptsub = csep->filters();
ParseTree* pt = fGwip.ptWorkStack.top();
ExistsFilter* subFilter = dynamic_cast<ExistsFilter*>(pt->data());
idbassert(subFilter);
subFilter->notExists(true);
SCSEP csep = subFilter->sub();
const ParseTree* ptsub = csep->filters();
if (ptsub)
ptsub->walk(makeAntiJoin);
if (ptsub)
ptsub->walk(makeAntiJoin);
ptsub = csep->having();
ptsub = csep->having();
if (ptsub)
ptsub->walk(makeAntiJoin);
if (ptsub)
ptsub->walk(makeAntiJoin);
}
}
} // namespace cal_impl_if