本文整理汇总了C++中SimpleFilter类的典型用法代码示例。如果您正苦于以下问题:C++ SimpleFilter类的具体用法?C++ SimpleFilter怎么用?C++ SimpleFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleFilter类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: combinable
Filter* ConstantFilter::combinable(Filter* f, Operator *op)
{
if (typeid(*f) == typeid(SimpleFilter))
{
SimpleFilter *sf = dynamic_cast<SimpleFilter*>(f);
return sf->combinable(this, op);
}
// constant filter may have NULL fOp, when it's equalivant to a pure simple filter
if (typeid(ConstantFilter) == typeid(*f) &&
(!fOp || fOp->data().compare(op->data()) == 0 ))
{
ConstantFilter *cf = dynamic_cast<ConstantFilter*>(f);
if (cf && ( !cf->op() || !fOp || fOp->data().compare(cf->op()->data()) == 0 )
&& fCol->sameColumn(cf->col().get()))
{
for (unsigned int i = 0; i < cf->filterList().size(); i++)
fFilterList.push_back(cf->filterList()[i]);
fOp.reset(op);
return this;
}
}
return NULL;
}
示例2: findSimpleFilter
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SimpleFilter* StrongMotionParameters::findSimpleFilter(const std::string& publicID) const {
SimpleFilter* object = SimpleFilter::Cast(PublicObject::Find(publicID));
if ( object != NULL && object->parent() == this )
return object;
return NULL;
}
示例3: makeAntiJoin
void makeAntiJoin(const ParseTree* n)
{
TreeNode* tn = n->data();
SimpleFilter* sf = dynamic_cast<SimpleFilter*>(tn);
if (!sf)
return;
uint64_t lJoinInfo = sf->lhs()->joinInfo();
if (lJoinInfo & JOIN_SEMI)
{
lJoinInfo &= ~JOIN_SEMI;
lJoinInfo |= JOIN_ANTI;
if (lJoinInfo & JOIN_NULLMATCH_CANDIDATE)
lJoinInfo |= JOIN_NULL_MATCH;
sf->lhs()->joinInfo(lJoinInfo);
}
uint64_t rJoinInfo = sf->rhs()->joinInfo();
if (rJoinInfo & JOIN_SEMI)
{
rJoinInfo &= ~JOIN_SEMI;
rJoinInfo |= JOIN_ANTI;
if (rJoinInfo & JOIN_NULLMATCH_CANDIDATE)
rJoinInfo |= JOIN_NULL_MATCH;
sf->rhs()->joinInfo(rJoinInfo);
}
}
示例4: getCurrentImageWindow
void
PidMain::openButterworthAlta()
{
ImageTabs* current = getCurrentImageWindow();
if (current != NULL)
{
SimpleFilter *filter = new SimpleFilter(this, current, new Butterworth(true));
filter->setAttribute(Qt::WA_DeleteOnClose);
filter->exec();
}
}
示例5: SEISCOMP_ERROR
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool StrongMotionParameters::add(SimpleFilter* simpleFilter) {
if ( simpleFilter == NULL )
return false;
// Element has already a parent
if ( simpleFilter->parent() != NULL ) {
SEISCOMP_ERROR("StrongMotionParameters::add(SimpleFilter*) -> element has already a parent");
return false;
}
if ( PublicObject::IsRegistrationEnabled() ) {
SimpleFilter* simpleFilterCached = SimpleFilter::Find(simpleFilter->publicID());
if ( simpleFilterCached ) {
if ( simpleFilterCached->parent() ) {
if ( simpleFilterCached->parent() == this )
SEISCOMP_ERROR("StrongMotionParameters::add(SimpleFilter*) -> element with same publicID has been added already");
else
SEISCOMP_ERROR("StrongMotionParameters::add(SimpleFilter*) -> element with same publicID has been added already to another object");
return false;
}
else
simpleFilter = simpleFilterCached;
}
}
// Add the element
_simpleFilters.push_back(simpleFilter);
simpleFilter->setParent(this);
// Create the notifiers
if ( Notifier::IsEnabled() ) {
NotifierCreator nc(OP_ADD);
simpleFilter->accept(&nc);
}
// Notify registered observers
childAdded(simpleFilter);
return true;
}
示例6: SimpleFilter
SimpleFilter* createSimpleFilter
(
CalpontSystemCatalog*& csc,
const CalpontSystemCatalog::TableColName& tcn,
const string& opstr,
ConstantColumn* cc
)
{
SimpleFilter* lsf = new SimpleFilter();
Operator* op = new Operator();
op->data(opstr);
CalpontSystemCatalog::ColType ccct;
ccct = op->resultType();
ccct.colDataType = cc->resultType().colDataType;
op->operationType(ccct);
SOP sop(op);
lsf->op(sop);
CalpontSystemCatalog::OID oid = csc->lookupOID(tcn);
CalpontSystemCatalog::ColType ct = csc->colType(oid);
SimpleColumn* sc = new SimpleColumn();
sc->schemaName(tcn.schema);
sc->tableName(tcn.table);
sc->tableAlias(tcn.table);
sc->columnName(tcn.column);
sc->oid(oid);
sc->resultType(ct);
sc->alias(tcn.toString());
lsf->lhs(sc);
lsf->rhs(cc);
return lsf;
}
示例7: updateChild
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool StrongMotionParameters::updateChild(Object* child) {
SimpleFilter* simpleFilterChild = SimpleFilter::Cast(child);
if ( simpleFilterChild != NULL ) {
SimpleFilter* simpleFilterElement
= SimpleFilter::Cast(PublicObject::Find(simpleFilterChild->publicID()));
if ( simpleFilterElement && simpleFilterElement->parent() == this ) {
*simpleFilterElement = *simpleFilterChild;
return true;
}
return false;
}
Record* recordChild = Record::Cast(child);
if ( recordChild != NULL ) {
Record* recordElement
= Record::Cast(PublicObject::Find(recordChild->publicID()));
if ( recordElement && recordElement->parent() == this ) {
*recordElement = *recordChild;
return true;
}
return false;
}
StrongOriginDescription* strongOriginDescriptionChild = StrongOriginDescription::Cast(child);
if ( strongOriginDescriptionChild != NULL ) {
StrongOriginDescription* strongOriginDescriptionElement
= StrongOriginDescription::Cast(PublicObject::Find(strongOriginDescriptionChild->publicID()));
if ( strongOriginDescriptionElement && strongOriginDescriptionElement->parent() == this ) {
*strongOriginDescriptionElement = *strongOriginDescriptionChild;
return true;
}
return false;
}
return false;
}
示例8: replaceRefCol
ParseTree* replaceRefCol(ParseTree*& n, CalpontSelectExecutionPlan::ReturnedColumnList& derivedColList)
{
ParseTree *lhs = n->left();
ParseTree *rhs = n->right();
if (lhs)
n->left(replaceRefCol(lhs, derivedColList));
if (rhs)
n->right(replaceRefCol(rhs, derivedColList));
SimpleFilter *sf = dynamic_cast<SimpleFilter*>(n->data());
ConstantFilter *cf = dynamic_cast<ConstantFilter*>(n->data());
ReturnedColumn *rc = dynamic_cast<ReturnedColumn*>(n->data());
if (sf)
{
sf->replaceRealCol(derivedColList);
}
else if (cf)
{
cf->replaceRealCol(derivedColList);
}
else if (rc)
{
SimpleColumn* sc = dynamic_cast<SimpleColumn*>(rc);
if (sc)
{
ReturnedColumn* tmp = derivedColList[sc->colPosition()]->clone();
delete sc;
n->data(tmp);
}
else
{
rc->replaceRealCol(derivedColList);
}
}
return n;
}
示例9: while
//.........这里部分代码省略.........
<< "have permission to read it. Skipping it." << endl;
continue;
}
} // End of 'while ( (sp3File = confReader.fetchListValue( ... "
// Load station nominal position
double xn(confReader.fetchListValueAsDouble("nominalPosition",station));
double yn(confReader.fetchListValueAsDouble("nominalPosition",station));
double zn(confReader.fetchListValueAsDouble("nominalPosition",station));
// The former peculiar code is possible because each time we
// call a 'fetchListValue' method, it takes out the first element
// and deletes it from the given variable list.
Position nominalPos( xn, yn, zn );
// Create a 'ProcessingList' object where we'll store
// the processing objects in order
ProcessingList pList;
// This object will check that all required observables are present
RequireObservables requireObs;
requireObs.addRequiredType(TypeID::P2);
requireObs.addRequiredType(TypeID::L1);
requireObs.addRequiredType(TypeID::L2);
// This object will check that code observations are within
// reasonable limits
SimpleFilter pObsFilter;
pObsFilter.setFilteredType(TypeID::P2);
// Read if we should use C1 instead of P1
bool usingC1( confReader.getValueAsBoolean( "useC1", station ) );
if ( usingC1 )
{
requireObs.addRequiredType(TypeID::C1);
pObsFilter.addFilteredType(TypeID::C1);
}
else
{
requireObs.addRequiredType(TypeID::P1);
pObsFilter.addFilteredType(TypeID::P1);
}
// Add 'requireObs' to processing list (it is the first)
pList.push_back(requireObs);
// IMPORTANT NOTE:
// It turns out that some receivers don't correct their clocks
// from drift.
// When this happens, their code observations may drift well beyond
// what it is usually expected from a pseudorange. In turn, this
// effect causes that "SimpleFilter" objects start to reject a lot of
// satellites.
// Thence, the "filterCode" option allows you to deactivate the
// "SimpleFilter" object that filters out C1, P1 and P2, in case you
// need to.
bool filterCode( confReader.getValueAsBoolean( "filterCode", station ) );
// Check if we are going to use this "SimpleFilter" object or not
if( filterCode )
示例10: if
/**
* Handle MySQL's plugin functions
* This is mostly for handling the null related functions that MySQL adds to the execution plan
*/
void InSub::handleFunc(gp_walk_info* gwip, Item_func* func)
{
if (func->functype() == Item_func::TRIG_COND_FUNC || func->functype() == Item_func::COND_OR_FUNC)
{
// purpose: remove the isnull() function from the parsetree in ptWorkStack.
// IDB handles the null semantics in the join operation
// trigcond(or_cond) is the only form we recognize for now
if (func->argument_count() > 2)
{
fGwip.fatalParseError = true;
fGwip.parseErrorText = "Unsupported item in IN subquery";
return;
}
Item_cond* cond;
if (func->functype() == Item_func::TRIG_COND_FUNC)
{
Item* item;
if (func->arguments()[0]->type() == Item::REF_ITEM)
item = (Item_ref*)(func->arguments()[0])->real_item();
else
item = func->arguments()[0];
cond = (Item_cond*)(item);
}
else
{
cond = (Item_cond*)(func);
}
if (cond->functype() == Item_func::COND_OR_FUNC)
{
// (cache=item) case. do nothing. ignore trigcond()?
if (cond->argument_list()->elements == 1)
return;
// (cache=item or isnull(item)) case. remove "or isnull()"
if (cond->argument_list()->elements == 2)
{
// don't know how to deal with this. don't think it's a fatal error either.
if (gwip->ptWorkStack.empty())
return;
ParseTree* pt = gwip->ptWorkStack.top();
if (!pt->left() || !pt->right())
return;
SimpleFilter* sf = dynamic_cast<SimpleFilter*>(pt->left()->data());
//assert (sf && sf->op()->op() == execplan::OP_ISNULL);
if (!sf || sf->op()->op() != execplan::OP_ISNULL)
return;
delete sf;
sf = dynamic_cast<SimpleFilter*>(pt->right()->data());
//idbassert(sf && sf->op()->op() == execplan::OP_EQ);
if (!sf || sf->op()->op() != execplan::OP_EQ)
return;
// set NULLMATCH for both operand. It's really a setting for the join.
// should only set NULLMATCH when the subtype is NOT_IN. for some IN subquery
// with aggregation column, MySQL inefficiently convert to:
// (cache=item or item is null) and item is not null, which is equivalent to
// cache = item. Do not set NULLMATCH for this case.
// Because we don't know IN or NOTIN yet, set candidate bit and switch to NULLMATCH
// later in handleNot function.
if (sf->lhs()->joinInfo() & JOIN_CORRELATED)
sf->lhs()->joinInfo(sf->lhs()->joinInfo() | JOIN_NULLMATCH_CANDIDATE);
if (sf->rhs()->joinInfo() & JOIN_CORRELATED)
sf->rhs()->joinInfo(sf->rhs()->joinInfo() | JOIN_NULLMATCH_CANDIDATE);
pt = pt->right();
gwip->ptWorkStack.pop();
gwip->ptWorkStack.push(pt);
}
}
else if (cond->functype() == Item_func::EQ_FUNC)
{
// not in (select const ...)
if (gwip->ptWorkStack.empty())
return;
ParseTree* pt = gwip->ptWorkStack.top();
SimpleFilter* sf = dynamic_cast<SimpleFilter*>(pt->data());
if (!sf || sf->op()->op() != execplan::OP_EQ)
return;
if (sf->lhs()->joinInfo() & JOIN_CORRELATED)
sf->lhs()->joinInfo(sf->lhs()->joinInfo() | JOIN_NULLMATCH_CANDIDATE);
//.........这里部分代码省略.........
示例11: main
int main(void)
{
/////////////////// INITIALIZATION PART /////////////////////
cout << fixed << setprecision(4); // Set a proper output format
// Create the input observation file stream
RinexObsStream rin("ebre0300.02o");
// Create the input observation file stream for REFERENCE STATION
RinexObsStream rinRef("bell0300.02o");
//// Broadcast ephemeris part
// Create the input navigation file stream
RinexNavStream rnavin("brdc0300.02n");
RinexNavData rNavData; // Object to store Rinex navigation data
GPSEphemerisStore bceStore; // Object to store satellites ephemeris
// Storing the ephemeris in "bceStore"
while (rnavin >> rNavData)
{
bceStore.addEphemeris(rNavData);
}
bceStore.SearchUser(); // This is the default
////
// EBRE station nominal position
Position nominalPos(4833520.1852, 41537.0453, 4147461.4963);
// BELL station nominal position
Position BnominalPos(4775849.4262, 116814.3084, 4213018.9143);
// Declare a NeillTropModel object, setting the defaults
NeillTropModel neillTM( nominalPos.getAltitude(),
nominalPos.getGeodeticLatitude(), 30);
// Declare a NeillTropModel object, setting the defaults (Ref. station)
NeillTropModel BneillTM( BnominalPos.getAltitude(),
BnominalPos.getGeodeticLatitude(), 30);
// This is the GNSS data structure that will hold all the
// GNSS-related information
gnssRinex gRin;
gnssRinex gRef;
// Declare base-changing objects: From ECEF to North-East-Up (NEU)
XYZ2NEU baseChange(nominalPos);
XYZ2NEU BbaseChange(BnominalPos);
// Declare a simple filter object to screen PC
SimpleFilter pcFilter;
pcFilter.setFilteredType(TypeID::PC);
// Declare a couple of basic modelers
BasicModel basic(nominalPos, bceStore);
BasicModel Bbasic(BnominalPos, bceStore);
// Objects to mark cycle slips
LICSDetector2 markCSLI; // Checks LI cycle slips
MWCSDetector markCSMW; // Checks Merbourne-Wubbena cycle slips
LICSDetector2 BmarkCSLI; // Checks LI cycle slips
MWCSDetector BmarkCSMW; // Checks Merbourne-Wubbena cycle slips
// Object to compute tidal effects
SolidTides solid;
// Ocean loading model
OceanLoading ocean("OCEAN-GOT00.dat");
// Numerical values are x,y pole displacements for Jan/30/2002 (arcsec).
PoleTides pole(-0.17153, 0.38661);
// Vector from EBRE antenna ARP to L1 phase center [UEN]
Triple offsetL1(0.110, 0.000, 0.000); // Units in meters
// Vector from EBRE antenna ARP to L2 phase center [UEN]
Triple offsetL2(0.128, 0.0000, 0.000); // Units in meters
// Vector from monument to antenna ARP [UEN] for EBRE station
Triple offsetARP(0.0, 0.0, 0.0); // Units in meters
//.........这里部分代码省略.........
示例12: if
SimpleFilter::SimpleFilter(const SimpleFilter& rhs) :
fOp(rhs.op()),
fIndexFlag(rhs.indexFlag()),
fJoinFlag(rhs.joinFlag())
{
fLhs = rhs.lhs()->clone();
fRhs = rhs.rhs()->clone();
fSimpleColumnList.clear();
fAggColumnList.clear();
fWindowFunctionColumnList.clear();
SimpleColumn *lsc = dynamic_cast<SimpleColumn*>(fLhs);
FunctionColumn *lfc = dynamic_cast<FunctionColumn*>(fLhs);
ArithmeticColumn *lac = dynamic_cast<ArithmeticColumn*>(fLhs);
WindowFunctionColumn *laf = dynamic_cast<WindowFunctionColumn*>(fLhs);
AggregateColumn *lagc = dynamic_cast<AggregateColumn*>(fLhs);
SimpleColumn *rsc = dynamic_cast<SimpleColumn*>(fRhs);
FunctionColumn *rfc = dynamic_cast<FunctionColumn*>(fRhs);
ArithmeticColumn *rac = dynamic_cast<ArithmeticColumn*>(fRhs);
AggregateColumn *ragc = dynamic_cast<AggregateColumn*>(fRhs);
WindowFunctionColumn *raf = dynamic_cast<WindowFunctionColumn*>(fRhs);
if (lsc)
{
fSimpleColumnList.push_back(lsc);
}
else if (lagc)
{
fAggColumnList.push_back(lagc);
}
else if (lfc)
{
fSimpleColumnList.insert(fSimpleColumnList.end(), lfc->simpleColumnList().begin(), lfc->simpleColumnList().end());
fAggColumnList.insert(fAggColumnList.end(), lfc->aggColumnList().begin(), lfc->aggColumnList().end());
fWindowFunctionColumnList.insert
(fWindowFunctionColumnList.end(), lfc->windowfunctionColumnList().begin(), lfc->windowfunctionColumnList().end());
}
else if (lac)
{
fSimpleColumnList.insert(fSimpleColumnList.end(), lac->simpleColumnList().begin(), lac->simpleColumnList().end());
fAggColumnList.insert(fAggColumnList.end(), lac->aggColumnList().begin(), lac->aggColumnList().end());
fWindowFunctionColumnList.insert
(fWindowFunctionColumnList.end(), lac->windowfunctionColumnList().begin(), lac->windowfunctionColumnList().end());
}
else if (laf)
{
fWindowFunctionColumnList.push_back(laf);
}
if (rsc)
{
fSimpleColumnList.push_back(rsc);
}
else if (ragc)
{
fAggColumnList.push_back(ragc);
}
else if (rfc)
{
fSimpleColumnList.insert
(fSimpleColumnList.end(), rfc->simpleColumnList().begin(), rfc->simpleColumnList().end());
fAggColumnList.insert
(fAggColumnList.end(), rfc->aggColumnList().begin(), rfc->aggColumnList().end());
fWindowFunctionColumnList.insert
(fWindowFunctionColumnList.end(), rfc->windowfunctionColumnList().begin(), rfc->windowfunctionColumnList().end());
}
else if (rac)
{
fSimpleColumnList.insert(fSimpleColumnList.end(), rac->simpleColumnList().begin(), rac->simpleColumnList().end());
fAggColumnList.insert(fAggColumnList.end(), rac->aggColumnList().begin(), rac->aggColumnList().end());
fWindowFunctionColumnList.insert
(fWindowFunctionColumnList.end(), rac->windowfunctionColumnList().begin(), rac->windowfunctionColumnList().end());
}
else if (raf)
{
fWindowFunctionColumnList.push_back(raf);
}
}
示例13: serializeCSEP
void serializeCSEP()
{
/*
* erydbSelectExecutionPlan
* This is a large class; it makes more sense to write == operators
* for everything than to write a giant equivalance test here.
* For now this is mostly a regression test.
*/
erydbSelectExecutionPlan csep1, csep2;
erydbSelectExecutionPlan::ReturnedColumnList colList;
ParseTree* filterList;
erydbExecutionPlan *cep;
ByteStream b;
cep = &csep2;
CPPUNIT_ASSERT(csep1 == csep2);
CPPUNIT_ASSERT(!(csep1 != csep2));
CPPUNIT_ASSERT(csep1 == cep);
CPPUNIT_ASSERT(!(csep1 != cep));
// returned columns
SimpleColumn *sc = new SimpleColumn("tpch.region.r_regionkey");
colList.push_back(sc);
// filters
erydbSelectExecutionPlan::Parser parser;
std::vector<Token> tokens;
Token t;
SimpleFilter *sf = new SimpleFilter();
SimpleColumn *lhs = new SimpleColumn(*sc);
SimpleColumn *rhs = new SimpleColumn("tpch.nation.n_regionkey");
Operator *op = new Operator("=");
sf->op(op);
sf->lhs(lhs);
sf->rhs(rhs);
t.value = sf;
tokens.push_back(t);
Operator *op1 = new Operator ("and");
t.value = op1;
tokens.push_back(t);
SimpleFilter *sf1 = new SimpleFilter();
SimpleColumn *lhs1 = new SimpleColumn (*rhs);
ConstantColumn *constCol = new ConstantColumn("3", ConstantColumn::NUM);
Operator *op2 = new Operator("!=");
sf1->op(op2);
sf1->lhs(lhs1);
sf1->rhs(constCol);
t.value = sf1;
tokens.push_back(t);
filterList = parser.parse(tokens.begin(), tokens.end());
// draw filterList tree
filterList->drawTree("selectExecutionPlan_1.dot");
// erydb execution plan
csep1.returnedCols (colList);
csep1.filters (filterList);
CPPUNIT_ASSERT(csep1 != csep2);
CPPUNIT_ASSERT(!(csep1 == csep2));
CPPUNIT_ASSERT(csep1 != cep);
CPPUNIT_ASSERT(!(csep1 == cep));
csep1.serialize(b);
csep2.unserialize(b);
CPPUNIT_ASSERT(b.length() == 0);
CPPUNIT_ASSERT(csep1 == csep2);
CPPUNIT_ASSERT(!(csep1 != csep2));
CPPUNIT_ASSERT(csep1 == cep);
CPPUNIT_ASSERT(!(csep1 != cep));
erydbSelectExecutionPlan csep3, csep4;
// subselect
erydbSelectExecutionPlan *subselect = new erydbSelectExecutionPlan;
subselect->location(erydbSelectExecutionPlan::WHERE);
subselect->dependent (false);
CPPUNIT_ASSERT (subselect->location() == erydbSelectExecutionPlan::WHERE);
CPPUNIT_ASSERT (subselect->dependent() == false);
erydbSelectExecutionPlan::SelectList selectList;
selectList.push_back(subselect);
csep3.subSelects(selectList);
// exist filter
erydbSelectExecutionPlan* cep1 = new erydbSelectExecutionPlan();
ExistsFilter *filter = new ExistsFilter();
delete filter;
filter = new ExistsFilter(cep1);
filter->exists(cep1);
//.........这里部分代码省略.........
示例14: selectExecutionPlan_1
void selectExecutionPlan_1() {
cout << "SQL: select region.r_regionkey from region, nation where nation.n_regionkey = region.r_regionkey and nation.n_regionkey != 3;" << endl;
erydbSelectExecutionPlan csep;
CPPUNIT_ASSERT (csep.location() == erydbSelectExecutionPlan::MAIN);
CPPUNIT_ASSERT (csep.dependent() == false);
CPPUNIT_ASSERT (csep.subSelects().size() == 0);
// returned columns
erydbSelectExecutionPlan::ReturnedColumnList colList;
SimpleColumn *sc = new SimpleColumn("tpch.region.r_regionkey", 0);
colList.push_back(sc);
ArithmeticColumn *ac = new ArithmeticColumn("a+sum(r_regionkey)", 0);
colList.push_back(ac);
csep.returnedCols (colList);
CPPUNIT_ASSERT(csep.returnedCols().size() == 2);
// filters
erydbSelectExecutionPlan::FilterTokenList filterTokenList;
SimpleFilter *sf = new SimpleFilter();
SimpleColumn *lhs = new SimpleColumn();
*lhs = *sc;
SimpleColumn *rhs = new SimpleColumn("tpch.nation.n_regionkey", 0);
CPPUNIT_ASSERT (*lhs == *sc);
CPPUNIT_ASSERT (*rhs != *lhs);
Operator *op = new Operator("=");
sf->op(op);
sf->lhs(lhs);
sf->rhs(rhs);
filterTokenList.push_back (sf);
filterTokenList.push_back( new Operator ("And") );
SimpleFilter *sf1 = new SimpleFilter (new Operator("="), sc->clone(), ac->clone());
filterTokenList.push_back (sf1);
csep.filterTokenList (filterTokenList);
ParseTree *filterList = const_cast<ParseTree*> (csep.filters());
// draw filterList tree
filterList->drawTree("selectExecutionPlan_1.dot");
csep.filters (filterList);
// Group by
erydbSelectExecutionPlan::GroupByColumnList groupByList;
groupByList.push_back(sc->clone());
csep.groupByCols (groupByList);
CPPUNIT_ASSERT(csep.groupByCols().size() == 1);
// Having
erydbSelectExecutionPlan::FilterTokenList havingTokenList;
SimpleFilter *having = new SimpleFilter( new Operator("="),
new ArithmeticColumn("sum(volumn)", 0),
new ConstantColumn(8));
havingTokenList.push_back (having);
csep.havingTokenList (havingTokenList);
CPPUNIT_ASSERT (*sf1 != *having);
CPPUNIT_ASSERT (csep.havingTokenList().size() == 1);
// Order by
erydbSelectExecutionPlan::OrderByColumnList orderByList;
ArithmeticColumn *o1 = new ArithmeticColumn(*ac);
o1->asc(false);
orderByList.push_back(o1);
csep.orderByCols(orderByList);
CPPUNIT_ASSERT(csep.orderByCols().size() == 1);
// another csep
erydbSelectExecutionPlan *newcsep = new erydbSelectExecutionPlan(erydbSelectExecutionPlan::FROM);
erydbSelectExecutionPlan::ReturnedColumnList ncolList;
SimpleColumn *newsc = new SimpleColumn("tpch.region.r_regionkey", 0);
ncolList.push_back(newsc);
newcsep->returnedCols (ncolList);
erydbSelectExecutionPlan::FilterTokenList nfilterTokenList;
SimpleFilter *newsf = new SimpleFilter ( new Operator (">"),
sc->clone(),
newsc->clone());
nfilterTokenList.push_back(newsf);
newcsep->filterTokenList (nfilterTokenList);
erydbSelectExecutionPlan::FilterTokenList nhavingTokenList;
SimpleFilter *newhaving = new SimpleFilter ( new Operator (">"),
sc->clone(),
newsc->clone());
CPPUNIT_ASSERT (*newsf == *newhaving);
nhavingTokenList.push_back(newhaving);
newcsep->havingTokenList (nhavingTokenList);
CPPUNIT_ASSERT (*newcsep != csep);
CPPUNIT_ASSERT (*newcsep->filters() == *newcsep->having());
ByteStream b;
csep.serialize (b);
newcsep->unserialize (b);
CPPUNIT_ASSERT (csep == *newcsep);
erydbSelectExecutionPlan::SelectList selectList;
selectList.push_back(newcsep);
csep.subSelects(selectList);
cout << "\nerydb Execution Plan:" << endl;
cout << csep;
cout << " --- end of test 1 ---" << endl;
//.........这里部分代码省略.........