1
0
Fork 0

Merge branch 'aql2' of https://github.com/triAGENS/ArangoDB into aql2

This commit is contained in:
Jan Steemann 2014-08-18 16:31:20 +02:00
commit 2d62ca94cc
2 changed files with 21 additions and 0 deletions

View File

@ -829,6 +829,7 @@ struct VarUsageFinder : public WalkerWorker<ExecutionNode> {
std::unordered_set<Variable const*> _usedLater;
std::unordered_set<Variable const*> _valid;
std::unordered_map<VariableId, ExecutionNode*> _varSetBy;
VarUsageFinder () {
};
@ -851,6 +852,7 @@ struct VarUsageFinder : public WalkerWorker<ExecutionNode> {
std::vector<Variable const*> setHere = en->getVariablesSetHere();
for (auto v : setHere) {
_valid.insert(v);
_varSetBy.insert(std::make_pair(v->id, en));
}
en->setVarsValid(_valid);
en->setVarUsageValid();
@ -867,6 +869,7 @@ struct VarUsageFinder : public WalkerWorker<ExecutionNode> {
void ExecutionPlan::findVarUsage () {
VarUsageFinder finder;
root()->walk(&finder);
_varSetBy = finder._varSetBy;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -97,6 +97,18 @@ namespace triagens {
TRI_ASSERT(_root != nullptr);
return _root->getCost();
}
////////////////////////////////////////////////////////////////////////////////
/// @brief get the node where variable with id <id> is introduced . . .
////////////////////////////////////////////////////////////////////////////////
ExecutionNode* getVarSetBy (VariableId id) const {
auto it = _varSetBy.find(id);
if( it == _varSetBy.end()){
return nullptr;
}
return (*it).second;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief find nodes of a certain type
@ -263,6 +275,12 @@ namespace triagens {
ExecutionNode* _root;
////////////////////////////////////////////////////////////////////////////////
/// @brief get the node where a variable is introducted.
////////////////////////////////////////////////////////////////////////////////
std::unordered_map<VariableId, ExecutionNode*> _varSetBy;
};
}