mirror of https://gitee.com/bigwinds/arangodb
fixed test
This commit is contained in:
parent
bcf23e2acf
commit
5d1986aafb
|
@ -64,7 +64,7 @@ function optimizerRuleTestSuite () {
|
||||||
db._drop(cn2);
|
db._drop(cn2);
|
||||||
c1 = db._create(cn1, {numberOfShards:9});
|
c1 = db._create(cn1, {numberOfShards:9});
|
||||||
c2 = db._create(cn2, {numberOfShards:9, shardKeys:["a","b"]});
|
c2 = db._create(cn2, {numberOfShards:9, shardKeys:["a","b"]});
|
||||||
for (i = 0; i < 10; i++){
|
for (i = 0; i < 10; i++) {
|
||||||
c1.insert({Hallo1:i});
|
c1.insert({Hallo1:i});
|
||||||
c2.insert({Hallo2:i});
|
c2.insert({Hallo2:i});
|
||||||
}
|
}
|
||||||
|
@ -85,10 +85,10 @@ function optimizerRuleTestSuite () {
|
||||||
|
|
||||||
testThisRuleEnabled : function () {
|
testThisRuleEnabled : function () {
|
||||||
var queries = [
|
var queries = [
|
||||||
[ "FOR d IN " + cn1 + " REMOVE d in " + cn1, 0],
|
"FOR d IN " + cn1 + " REMOVE d in " + cn1,
|
||||||
[ "FOR d IN " + cn1 + " REMOVE d._key in " + cn1, 1],
|
"FOR d IN " + cn1 + " REMOVE d._key in " + cn1,
|
||||||
[ "FOR d IN " + cn1 + " INSERT d in " + cn2, 2],
|
"FOR d IN " + cn1 + " INSERT d in " + cn2,
|
||||||
[ "FOR d IN " + cn1 + " INSERT d._key in " + cn2, 3]
|
"FOR d IN " + cn1 + " INSERT d._key in " + cn2
|
||||||
];
|
];
|
||||||
|
|
||||||
var expectedRules = [
|
var expectedRules = [
|
||||||
|
@ -104,6 +104,11 @@ function optimizerRuleTestSuite () {
|
||||||
[
|
[
|
||||||
"distribute-in-cluster",
|
"distribute-in-cluster",
|
||||||
"scatter-in-cluster"
|
"scatter-in-cluster"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster",
|
||||||
|
"distribute-filtercalc-to-cluster"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -116,7 +121,10 @@ function optimizerRuleTestSuite () {
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode"
|
"RemoteNode",
|
||||||
|
"RemoveNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"SingletonNode",
|
"SingletonNode",
|
||||||
|
@ -127,23 +135,44 @@ function optimizerRuleTestSuite () {
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode"
|
"RemoteNode",
|
||||||
|
"RemoveNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"SingletonNode",
|
||||||
|
"ScatterNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"EnumerateCollectionNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode",
|
||||||
|
"DistributeNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"InsertNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"SingletonNode",
|
||||||
|
"ScatterNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"EnumerateCollectionNode",
|
||||||
|
"CalculationNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode",
|
||||||
|
"DistributeNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"InsertNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
var finalNodes = [
|
queries.forEach(function(query, i) {
|
||||||
"RemoveNode", "RemoveNode",
|
var result = AQL_EXPLAIN(query, { }, thisRuleEnabled);
|
||||||
"InsertNode", "InsertNode"
|
|
||||||
];
|
|
||||||
|
|
||||||
queries.forEach(function(query) {
|
|
||||||
var i = query[1] % 2;
|
|
||||||
var result = AQL_EXPLAIN(query[0], { }, thisRuleEnabled);
|
|
||||||
assertEqual(expectedRules[i], result.plan.rules, query);
|
assertEqual(expectedRules[i], result.plan.rules, query);
|
||||||
expectedNodes[i].push(finalNodes[query[1]]);
|
|
||||||
assertEqual(expectedNodes[i], explain(result), query);
|
assertEqual(expectedNodes[i], explain(result), query);
|
||||||
expectedNodes[i].pop();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -153,13 +182,24 @@ function optimizerRuleTestSuite () {
|
||||||
|
|
||||||
testThisRuleDisabled : function () {
|
testThisRuleDisabled : function () {
|
||||||
var queries = [
|
var queries = [
|
||||||
[ "FOR d IN " + cn1 + " REMOVE d in " + cn1, 0],
|
"FOR d IN " + cn1 + " REMOVE d in " + cn1,
|
||||||
[ "FOR d IN " + cn1 + " REMOVE d._key in " + cn1, 1],
|
"FOR d IN " + cn1 + " REMOVE d._key in " + cn1,
|
||||||
[ "FOR d IN " + cn1 + " INSERT d in " + cn2, 2],
|
"FOR d IN " + cn1 + " INSERT d in " + cn2,
|
||||||
[ "FOR d IN " + cn1 + " INSERT d._key in " + cn2, 3],
|
"FOR d IN " + cn1 + " INSERT d._key in " + cn2,
|
||||||
];
|
];
|
||||||
|
|
||||||
var expectedRules = [
|
var expectedRules = [
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster",
|
||||||
|
"remove-unnecessary-remote-scatter"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster",
|
||||||
|
"distribute-filtercalc-to-cluster",
|
||||||
|
"remove-unnecessary-remote-scatter"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"distribute-in-cluster",
|
"distribute-in-cluster",
|
||||||
"scatter-in-cluster",
|
"scatter-in-cluster",
|
||||||
|
@ -180,7 +220,10 @@ function optimizerRuleTestSuite () {
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode"
|
"RemoteNode",
|
||||||
|
"RemoveNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"SingletonNode",
|
"SingletonNode",
|
||||||
|
@ -189,24 +232,43 @@ function optimizerRuleTestSuite () {
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode"
|
"RemoteNode",
|
||||||
|
"RemoveNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"SingletonNode",
|
||||||
|
"EnumerateCollectionNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode",
|
||||||
|
"DistributeNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"InsertNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"SingletonNode",
|
||||||
|
"EnumerateCollectionNode",
|
||||||
|
"CalculationNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode",
|
||||||
|
"DistributeNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"InsertNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
var finalNodes = [
|
queries.forEach(function(query, i) {
|
||||||
"RemoveNode", "RemoveNode",
|
|
||||||
"InsertNode", "InsertNode"
|
|
||||||
];
|
|
||||||
|
|
||||||
queries.forEach(function(query) {
|
|
||||||
// can't turn this rule off so should always get the same answer
|
// can't turn this rule off so should always get the same answer
|
||||||
var i = query[1] % 2;
|
var result = AQL_EXPLAIN(query, { }, rulesAll);
|
||||||
var result = AQL_EXPLAIN(query[0], { }, rulesAll);
|
|
||||||
assertEqual(expectedRules[i], result.plan.rules, query);
|
assertEqual(expectedRules[i], result.plan.rules, query);
|
||||||
expectedNodes[i].push(finalNodes[query[1]]);
|
result = AQL_EXPLAIN(query, { }, thisRuleDisabled);
|
||||||
result = AQL_EXPLAIN(query[0], { }, thisRuleDisabled);
|
|
||||||
assertEqual(expectedNodes[i], explain(result), query);
|
assertEqual(expectedNodes[i], explain(result), query);
|
||||||
expectedNodes[i].pop();
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -216,13 +278,24 @@ function optimizerRuleTestSuite () {
|
||||||
|
|
||||||
testRulesAll : function () {
|
testRulesAll : function () {
|
||||||
var queries = [
|
var queries = [
|
||||||
[ "FOR d IN " + cn1 + " REMOVE d in " + cn1, 0],
|
"FOR d IN " + cn1 + " REMOVE d in " + cn1,
|
||||||
[ "FOR d IN " + cn1 + " REMOVE d._key in " + cn1, 1],
|
"FOR d IN " + cn1 + " REMOVE d._key in " + cn1,
|
||||||
[ "FOR d IN " + cn1 + " INSERT d in " + cn2, 2],
|
"FOR d IN " + cn1 + " INSERT d in " + cn2,
|
||||||
[ "FOR d IN " + cn1 + " INSERT d._key in " + cn2, 3],
|
"FOR d IN " + cn1 + " INSERT d._key in " + cn2,
|
||||||
];
|
];
|
||||||
|
|
||||||
var expectedRules = [
|
var expectedRules = [
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster",
|
||||||
|
"remove-unnecessary-remote-scatter"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster",
|
||||||
|
"distribute-filtercalc-to-cluster",
|
||||||
|
"remove-unnecessary-remote-scatter"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"distribute-in-cluster",
|
"distribute-in-cluster",
|
||||||
"scatter-in-cluster",
|
"scatter-in-cluster",
|
||||||
|
@ -243,7 +316,10 @@ function optimizerRuleTestSuite () {
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode"
|
"RemoteNode",
|
||||||
|
"RemoveNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"SingletonNode",
|
"SingletonNode",
|
||||||
|
@ -252,23 +328,41 @@ function optimizerRuleTestSuite () {
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode"
|
"RemoteNode",
|
||||||
|
"RemoveNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"SingletonNode",
|
||||||
|
"EnumerateCollectionNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode",
|
||||||
|
"DistributeNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"InsertNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"SingletonNode",
|
||||||
|
"EnumerateCollectionNode",
|
||||||
|
"CalculationNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode",
|
||||||
|
"DistributeNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"InsertNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
var finalNodes = [
|
queries.forEach(function(query, i) {
|
||||||
"RemoveNode", "RemoveNode",
|
|
||||||
"InsertNode", "InsertNode"
|
|
||||||
];
|
|
||||||
|
|
||||||
queries.forEach(function(query) {
|
|
||||||
// can't turn this rule off so should always get the same answer
|
// can't turn this rule off so should always get the same answer
|
||||||
var i = query[1] % 2;
|
var result = AQL_EXPLAIN(query, { }, rulesAll);
|
||||||
var result = AQL_EXPLAIN(query[0], { }, rulesAll);
|
|
||||||
assertEqual(expectedRules[i], result.plan.rules, query);
|
assertEqual(expectedRules[i], result.plan.rules, query);
|
||||||
expectedNodes[i].push(finalNodes[query[1]]);
|
|
||||||
assertEqual(expectedNodes[i], explain(result), query);
|
assertEqual(expectedNodes[i], explain(result), query);
|
||||||
expectedNodes[i].pop();
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -278,13 +372,22 @@ function optimizerRuleTestSuite () {
|
||||||
|
|
||||||
testRulesNone : function () {
|
testRulesNone : function () {
|
||||||
var queries = [
|
var queries = [
|
||||||
[ "FOR d IN " + cn1 + " REMOVE d in " + cn1, 0],
|
"FOR d IN " + cn1 + " REMOVE d in " + cn1,
|
||||||
[ "FOR d IN " + cn1 + " REMOVE d._key in " + cn1, 1],
|
"FOR d IN " + cn1 + " REMOVE d._key in " + cn1,
|
||||||
[ "FOR d IN " + cn1 + " INSERT d in " + cn2, 2],
|
"FOR d IN " + cn1 + " INSERT d in " + cn2,
|
||||||
[ "FOR d IN " + cn1 + " INSERT d._key in " + cn2, 3],
|
"FOR d IN " + cn1 + " INSERT d._key in " + cn2,
|
||||||
];
|
];
|
||||||
|
|
||||||
var expectedRules = [
|
var expectedRules = [
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster",
|
||||||
|
"distribute-filtercalc-to-cluster",
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"distribute-in-cluster",
|
"distribute-in-cluster",
|
||||||
"scatter-in-cluster",
|
"scatter-in-cluster",
|
||||||
|
@ -305,7 +408,10 @@ function optimizerRuleTestSuite () {
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode"
|
"RemoteNode",
|
||||||
|
"RemoveNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"SingletonNode",
|
"SingletonNode",
|
||||||
|
@ -316,24 +422,45 @@ function optimizerRuleTestSuite () {
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode"
|
"RemoteNode",
|
||||||
|
"RemoveNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"SingletonNode",
|
||||||
|
"ScatterNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"EnumerateCollectionNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode",
|
||||||
|
"DistributeNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"InsertNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"SingletonNode",
|
||||||
|
"ScatterNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"EnumerateCollectionNode",
|
||||||
|
"CalculationNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode",
|
||||||
|
"DistributeNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"InsertNode",
|
||||||
|
"RemoteNode",
|
||||||
|
"GatherNode"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
var finalNodes = [
|
queries.forEach(function(query, i) {
|
||||||
"RemoveNode", "RemoveNode",
|
|
||||||
"InsertNode", "InsertNode"
|
|
||||||
];
|
|
||||||
|
|
||||||
queries.forEach(function(query) {
|
|
||||||
// can't turn this rule off so should always get the same answer
|
// can't turn this rule off so should always get the same answer
|
||||||
var i = query[1] % 2;
|
var result = AQL_EXPLAIN(query, { }, rulesNone);
|
||||||
var result = AQL_EXPLAIN(query[0], { }, rulesNone);
|
|
||||||
assertEqual(expectedRules[i], result.plan.rules, query);
|
assertEqual(expectedRules[i], result.plan.rules, query);
|
||||||
expectedNodes[i].push(finalNodes[query[1]]);
|
|
||||||
assertEqual(expectedNodes[i], explain(result), query);
|
assertEqual(expectedNodes[i], explain(result), query);
|
||||||
expectedNodes[i].pop();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue