mirror of https://gitee.com/bigwinds/arangodb
parent
a83d42d0e9
commit
68b112e45a
|
@ -1,6 +1,8 @@
|
|||
v3.4.4 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
||||
* fixed issue #8165: AQL optimizer does not pick up multiple Geo index
|
||||
|
||||
* when creating a new database with an initial user, set the database permission
|
||||
for this user as specified in the documentation
|
||||
|
||||
|
|
|
@ -6951,7 +6951,9 @@ void arangodb::aql::geoIndexRule(Optimizer* opt, std::unique_ptr<ExecutionPlan>
|
|||
|
||||
// if info is valid we try to optimize ENUMERATE_COLLECTION
|
||||
if (info && info.collectionNodeToReplace == node) {
|
||||
mod = mod || applyGeoOptimization(plan.get(), limit, info);
|
||||
if (applyGeoOptimization(plan.get(), limit, info)) {
|
||||
mod = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,22 +54,22 @@ function legacyOptimizerRuleTestSuite() {
|
|||
var colName = "UnitTestsAqlOptimizerGeoIndex";
|
||||
|
||||
var geocol;
|
||||
var hasSortNode = function (plan,query) {
|
||||
var hasSortNode = function (plan, query) {
|
||||
assertEqual(findExecutionNodes(plan, "SortNode").length, 1, query.string + " Has SortNode ");
|
||||
};
|
||||
var hasNoSortNode = function (plan,query) {
|
||||
var hasNoSortNode = function (plan, query) {
|
||||
assertEqual(findExecutionNodes(plan, "SortNode").length, 0, query.string + " Has no SortNode");
|
||||
};
|
||||
var hasFilterNode = function (plan,query) {
|
||||
var hasFilterNode = function (plan, query) {
|
||||
assertEqual(findExecutionNodes(plan, "FilterNode").length, 1, query.string + " Has FilterNode");
|
||||
};
|
||||
var hasNoFilterNode = function (plan,query) {
|
||||
var hasNoFilterNode = function (plan, query) {
|
||||
assertEqual(findExecutionNodes(plan, "FilterNode").length, 0, query.string + " Has no FilterNode");
|
||||
};
|
||||
var hasNoIndexNode = function (plan,query) {
|
||||
var hasNoIndexNode = function (plan, query) {
|
||||
assertEqual(findExecutionNodes(plan, "IndexNode").length, 0, query.string + " Has no IndexNode");
|
||||
};
|
||||
var hasIndexNode = function (plan,query) {
|
||||
var hasIndexNode = function (plan, query) {
|
||||
var rn = findExecutionNodes(plan,"IndexNode");
|
||||
assertEqual(rn.length, 1, query.string + " Has IndexNode");
|
||||
assertEqual(rn[0].indexes.length, 1);
|
||||
|
@ -446,20 +446,38 @@ function optimizerRuleTestSuite() {
|
|||
db._drop("UnitTestsGeoJsonTestSuite");
|
||||
},
|
||||
|
||||
testRuleMultiIndexes: function () {
|
||||
let query = "LET x1 = (FOR d IN " + colName + " SORT distance(d.lat, d.lon, 0, 0) LIMIT 1 RETURN d) LET x2 = (FOR d IN " + colName + " SORT distance(d.lat, d.lon, 0, 0) LIMIT 1 RETURN d) RETURN { x1, x2 }";
|
||||
let plan = AQL_EXPLAIN(query).plan;
|
||||
assertNotEqual(-1, plan.rules.indexOf("geo-index-optimizer"));
|
||||
|
||||
let nodes = helper.findExecutionNodes(plan, "IndexNode");
|
||||
assertEqual(2, nodes.length);
|
||||
nodes.forEach(function(n) {
|
||||
assertEqual("IndexNode", n.type);
|
||||
assertEqual(colName, n.collection);
|
||||
assertEqual(1, n.indexes.length);
|
||||
let index = n.indexes[0];
|
||||
|
||||
assertEqual("geo", index.type);
|
||||
assertEqual(["lat", "lon"], index.fields);
|
||||
});
|
||||
},
|
||||
|
||||
testRuleBasics: function () {
|
||||
if (enabled.basics) {
|
||||
geocol.ensureIndex({ type: "hash", fields: ["y", "z"], unique: false });
|
||||
|
||||
var queries = [
|
||||
{
|
||||
string: "FOR d IN " + colName + " SORT distance(d.lat, d.lon, 0 ,0 ) ASC LIMIT 1 RETURN d",
|
||||
string: "FOR d IN " + colName + " SORT distance(d.lat, d.lon, 0, 0) ASC LIMIT 1 RETURN d",
|
||||
cluster: false,
|
||||
sort: false,
|
||||
filter: false,
|
||||
index: true
|
||||
},
|
||||
{
|
||||
string: "FOR d IN " + colName + " SORT distance(d.loca.tion.lat, d.loca.tion.lon, 0 ,0 ) ASC LIMIT 1 RETURN d",
|
||||
string: "FOR d IN " + colName + " SORT distance(d.loca.tion.lat, d.loca.tion.lon, 0, 0) ASC LIMIT 1 RETURN d",
|
||||
cluster: false,
|
||||
sort: false,
|
||||
filter: false,
|
||||
|
|
Loading…
Reference in New Issue