mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'aql2' of https://github.com/triAGENS/ArangoDB into aql2
This commit is contained in:
commit
2d62ca94cc
|
@ -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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -98,6 +98,18 @@ namespace triagens {
|
|||
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;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue