mirror of https://gitee.com/bigwinds/arangodb
fixed collect in cluster
This commit is contained in:
parent
c88109679d
commit
d9add3a493
|
@ -557,6 +557,7 @@ SHELL_SERVER_AQL = @top_srcdir@/js/server/tests/aql-arithmetic.js \
|
|||
@top_srcdir@/js/server/tests/aql-edges-noncluster.js \
|
||||
@top_srcdir@/js/server/tests/aql-escaping.js \
|
||||
@top_srcdir@/js/server/tests/aql-explain-noncluster.js \
|
||||
@top_srcdir@/js/server/tests/aql-failures-noncluster.js \
|
||||
@top_srcdir@/js/server/tests/aql-fullcount.js \
|
||||
@top_srcdir@/js/server/tests/aql-functions.js \
|
||||
@top_srcdir@/js/server/tests/aql-functions-date.js \
|
||||
|
|
|
@ -2360,10 +2360,13 @@ ExecutionNode* AggregateNode::clone (ExecutionPlan* plan,
|
|||
outVariable = plan->getAst()->variables()->createVariable(outVariable);
|
||||
}
|
||||
|
||||
for (auto oneAggregate: _aggregateVariables) {
|
||||
auto in = plan->getAst()->variables()->createVariable(oneAggregate.first);
|
||||
auto out = plan->getAst()->variables()->createVariable(oneAggregate.second);
|
||||
aggregateVariables.emplace_back(std::make_pair(in, out));
|
||||
// need to re-create all variables
|
||||
aggregateVariables.clear();
|
||||
|
||||
for (auto it : _aggregateVariables) {
|
||||
auto out = plan->getAst()->variables()->createVariable(it.first);
|
||||
auto in = plan->getAst()->variables()->createVariable(it.second);
|
||||
aggregateVariables.emplace_back(std::make_pair(out, in));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1046,7 +1046,7 @@ namespace triagens {
|
|||
bool withProperties) const override final;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief the cost of an enumerate list node is . . . FIXME
|
||||
/// @brief the cost of an enumerate list node
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
double estimateCost (size_t&) const override final;
|
||||
|
@ -1524,7 +1524,7 @@ namespace triagens {
|
|||
/// @brief getVariablesSetHere
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual std::vector<Variable const*> getVariablesSetHere () const {
|
||||
virtual std::vector<Variable const*> getVariablesSetHere () const override final {
|
||||
std::vector<Variable const*> v{ _outVariable };
|
||||
return v;
|
||||
}
|
||||
|
@ -2188,7 +2188,7 @@ namespace triagens {
|
|||
/// @brief getVariablesSetHere
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::vector<Variable const*> getVariablesSetHere () const {
|
||||
std::vector<Variable const*> getVariablesSetHere () const override final {
|
||||
std::vector<Variable const*> v;
|
||||
size_t const n = _aggregateVariables.size() + (_outVariable == nullptr ? 0 : 1);
|
||||
v.reserve(n);
|
||||
|
|
|
@ -287,7 +287,7 @@ int Optimizer::createPlans (ExecutionPlan* plan,
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief translate a list of rule ids into rule name
|
||||
/// @brief translate a list of rule ids into rule names
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::vector<std::string> Optimizer::translateRules (std::vector<int> const& rules) {
|
||||
|
|
|
@ -3631,7 +3631,6 @@ int triagens::aql::distributeFilternCalcToClusterRule (Optimizer* opt,
|
|||
switch (inspectNode->getType()) {
|
||||
case EN::ENUMERATE_LIST:
|
||||
case EN::SINGLETON:
|
||||
case EN::AGGREGATE:
|
||||
case EN::INSERT:
|
||||
case EN::REMOVE:
|
||||
case EN::REPLACE:
|
||||
|
@ -3639,6 +3638,8 @@ int triagens::aql::distributeFilternCalcToClusterRule (Optimizer* opt,
|
|||
case EN::UPSERT:
|
||||
parents = inspectNode->getParents();
|
||||
continue;
|
||||
|
||||
case EN::AGGREGATE:
|
||||
case EN::SUBQUERY:
|
||||
case EN::RETURN:
|
||||
case EN::NORESULTS:
|
||||
|
@ -3646,14 +3647,15 @@ int triagens::aql::distributeFilternCalcToClusterRule (Optimizer* opt,
|
|||
case EN::DISTRIBUTE:
|
||||
case EN::GATHER:
|
||||
case EN::ILLEGAL:
|
||||
//do break
|
||||
case EN::REMOTE:
|
||||
case EN::LIMIT:
|
||||
case EN::SORT:
|
||||
case EN::INDEX_RANGE:
|
||||
case EN::ENUMERATE_COLLECTION:
|
||||
//do break
|
||||
stopSearching = true;
|
||||
break;
|
||||
|
||||
case EN::CALCULATION: {
|
||||
auto calc = static_cast<CalculationNode const*>(inspectNode);
|
||||
// check if the expression can be executed on a DB server safely
|
||||
|
|
|
@ -52,6 +52,60 @@ function optimizerCollectMethodsTestSuite () {
|
|||
db._drop("UnitTestsCollection");
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief number of plans
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testHashedNumberOfPlans : function () {
|
||||
var queries = [
|
||||
"FOR j IN " + c.name() + " COLLECT value = j RETURN value",
|
||||
"FOR j IN " + c.name() + " COLLECT value = j WITH COUNT INTO l RETURN [ value, l ]"
|
||||
];
|
||||
|
||||
queries.forEach(function(query) {
|
||||
var plans = AQL_EXPLAIN(query, null, { allPlans: true, optimizer: { rules: [ "-all" ] } }).plans;
|
||||
|
||||
assertEqual(2, plans.length);
|
||||
});
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief number of plans
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSortedNumberOfPlans : function () {
|
||||
c.ensureIndex({ type: "skiplist", fields: [ "value" ] });
|
||||
var queries = [
|
||||
"FOR j IN " + c.name() + " COLLECT value = j RETURN value",
|
||||
"FOR j IN " + c.name() + " COLLECT value = j WITH COUNT INTO l RETURN [ value, l ]"
|
||||
];
|
||||
|
||||
queries.forEach(function(query) {
|
||||
var plans = AQL_EXPLAIN(query, null, { allPlans: true, optimizer: { rules: [ "-all" ] } }).plans;
|
||||
|
||||
assertEqual(2, plans.length);
|
||||
});
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief number of plans
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNumberOfPlansWithInto : function () {
|
||||
var queries = [
|
||||
"FOR j IN " + c.name() + " COLLECT value = j INTO g RETURN g",
|
||||
"FOR j IN " + c.name() + " COLLECT value = j INTO g = j._key RETURN g",
|
||||
"FOR j IN " + c.name() + " COLLECT value = j INTO g RETURN [ value, g ]",
|
||||
"FOR j IN " + c.name() + " COLLECT value = j INTO g KEEP j RETURN g"
|
||||
];
|
||||
|
||||
queries.forEach(function(query) {
|
||||
var plans = AQL_EXPLAIN(query, null, { allPlans: true, optimizer: { rules: [ "-all" ] } }).plans;
|
||||
|
||||
assertEqual(1, plans.length);
|
||||
});
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief expect hash COLLECT
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue