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

MCOL-911 getAggCols needs to look into the objects

This commit is contained in:
David Hall
2017-09-14 23:29:54 -05:00
committed by Andrew Hutchings
parent de457bfe4b
commit c4269871fe
3 changed files with 57 additions and 23 deletions

View File

@ -55,15 +55,29 @@ void getAggCols(execplan::ParseTree* n, void* obj)
SimpleFilter *sf = dynamic_cast<SimpleFilter*>(tn);
ConstantFilter *cf = dynamic_cast<ConstantFilter*>(tn);
if (sc)
{
list->push_back(sc);
}
else if (fc)
{
fc->hasAggregate();
list->insert(list->end(), fc->aggColumnList().begin(), fc->aggColumnList().end());
}
else if (ac)
{
ac->hasAggregate();
list->insert(list->end(), ac->aggColumnList().begin(), ac->aggColumnList().end());
}
else if (sf)
{
sf->hasAggregate();
list->insert(list->end(), sf->aggColumnList().begin(), sf->aggColumnList().end());
}
else if (cf)
{
cf->hasAggregate();
list->insert(list->end(), cf->aggColumnList().begin(), cf->aggColumnList().end());
}
}
/**

View File

@ -121,14 +121,22 @@ ostream& operator<<(ostream& output, const ConstantFilter& rhs)
bool ConstantFilter::hasAggregate()
{
fAggColumnList.clear();
if (fAggColumnList.empty())
{
for (uint32_t i = 0; i < fFilterList.size(); i++)
{
if (fFilterList[i]->hasAggregate())
{
return true;
fAggColumnList.insert(fAggColumnList.end(),
fFilterList[i]->aggColumnList().begin(),
fFilterList[i]->aggColumnList().end());
}
}
}
if (!fAggColumnList.empty())
{
return true;
}
return false;
}

View File

@ -648,27 +648,39 @@ void SimpleFilter::setSimpleColumnList()
bool SimpleFilter::hasAggregate()
{
if (fAggColumnList.empty())
{
AggregateColumn *lac = dynamic_cast<AggregateColumn*>(fLhs);
AggregateColumn *rac = dynamic_cast<AggregateColumn*>(fRhs);
fAggColumnList.clear();
if (lac)
{
return true;
fAggColumnList.insert(fAggColumnList.end(), lac);
}
else if (fLhs)
{
if (fLhs->hasAggregate())
return true;
}
if (rac)
{
return true;
fAggColumnList.insert(fAggColumnList.end(), rac);
}
else if (fRhs)
if (fLhs)
{
if (fLhs->hasAggregate())
fAggColumnList.insert(fAggColumnList.end(),
fLhs->aggColumnList().begin(),
fLhs->aggColumnList().end());
}
if (fRhs)
{
if (fRhs->hasAggregate())
fAggColumnList.insert(fAggColumnList.end(),
fRhs->aggColumnList().begin(),
fRhs->aggColumnList().end());
}
}
if (!fAggColumnList.empty())
{
return true;
}
return false;