mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
e6121b4464
|
@ -379,8 +379,52 @@ function arrayIndexCrazyQueriesSuite () {
|
||||||
db._drop(cName);
|
db._drop(cName);
|
||||||
},
|
},
|
||||||
|
|
||||||
testLongChainediArrayHash : function () {
|
/* Needs a decission for nested arrays
|
||||||
|
testLongChainedArrayHash : function () {
|
||||||
|
var idx = col.ensureHashIndex("the[*].quick.brown.foxx[*].jumps[*].over.the.lazy.dog[*]").id;
|
||||||
|
const buildDocument = function (dog1, dog2) {
|
||||||
|
dog2 = dog2 || dog1;
|
||||||
|
var doc = { the: [] };
|
||||||
|
var foxx = [];
|
||||||
|
var jumps = [];
|
||||||
|
jumps.push({over : { the: { lazy: { dog: dog1 } } } });
|
||||||
|
jumps.push({over : { the: { lazy: { dog: dog2 } } } });
|
||||||
|
foxx.push(jumps);
|
||||||
|
doc.the.push({ quick: { brown: { foxx } } });
|
||||||
|
return doc;
|
||||||
|
};
|
||||||
|
col.save(buildDocument([1], [42]));
|
||||||
|
col.save(buildDocument([1,3,4], [5,6,7]));
|
||||||
|
col.save(buildDocument([3,4], [5,6,7]));
|
||||||
|
col.save(buildDocument([3,4], [5,6,7]));
|
||||||
|
|
||||||
|
var checkIsOptimizedQuery = function (query, bindVars) {
|
||||||
|
var plan = AQL_EXPLAIN(query, bindVars).plan;
|
||||||
|
var nodeTypes = plan.nodes.map(function(node) {
|
||||||
|
return node.type;
|
||||||
|
});
|
||||||
|
require("internal").print(bindVars);
|
||||||
|
require("org/arangodb/aql/explainer").explain({query, bindVars});
|
||||||
|
assertEqual("SingletonNode", nodeTypes[0], query);
|
||||||
|
assertEqual(-1, nodeTypes.indexOf("EnumerateCollection"),
|
||||||
|
"found EnumerateCollection node for:" + query);
|
||||||
|
var idxNodeId = nodeTypes.indexOf("IndexNode");
|
||||||
|
assertNotEqual(-1, idxNodeId, "no index used for: " + query);
|
||||||
|
var idxNode = plan.nodes[idxNodeId];
|
||||||
|
require("internal").print(idxNode);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const query = `FOR x IN ${cName} FILTER @tag
|
||||||
|
IN x.the[*].quick.brown.foxx[*].jumps[*].over.the.lazy.dog[*]
|
||||||
|
SORT x._key RETURN x._key`;
|
||||||
|
var bindVars = {};
|
||||||
|
|
||||||
|
bindVars.tag = 42;
|
||||||
|
checkIsOptimizedQuery(query, bindVars);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -298,6 +298,7 @@ function arrayHashIndexSuite () {
|
||||||
assertEqual(res.length, 0);
|
assertEqual(res.length, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/* TODO Decission required here
|
||||||
testInsertAndReadNestedElements: function () {
|
testInsertAndReadNestedElements: function () {
|
||||||
var idx = collection.ensureHashIndex("a[*].b").id;
|
var idx = collection.ensureHashIndex("a[*].b").id;
|
||||||
var id1 = collection.save({a: [{b: 1}]})._id;
|
var id1 = collection.save({a: [{b: 1}]})._id;
|
||||||
|
@ -305,7 +306,6 @@ function arrayHashIndexSuite () {
|
||||||
collection.save({a: [1,2,3]});
|
collection.save({a: [1,2,3]});
|
||||||
collection.save({b: [1,2,3]});
|
collection.save({b: [1,2,3]});
|
||||||
|
|
||||||
/*
|
|
||||||
var res = collection.BY_EXAMPLE_HASH(idx, {a: {b: 1} }, 0, null).documents;
|
var res = collection.BY_EXAMPLE_HASH(idx, {a: {b: 1} }, 0, null).documents;
|
||||||
assertEqual(res.length, 2);
|
assertEqual(res.length, 2);
|
||||||
assertEqual(res[0]._id, id1);
|
assertEqual(res[0]._id, id1);
|
||||||
|
@ -314,8 +314,8 @@ function arrayHashIndexSuite () {
|
||||||
res = collection.BY_EXAMPLE_HASH(idx, {a: {b: 2} }, 0, null).documents;
|
res = collection.BY_EXAMPLE_HASH(idx, {a: {b: 2} }, 0, null).documents;
|
||||||
assertEqual(res.length, 1);
|
assertEqual(res.length, 1);
|
||||||
assertEqual(res[0]._id, id2);
|
assertEqual(res[0]._id, id2);
|
||||||
*/
|
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue