From c6cd5574b15af04a61717c6817fa5c8c2a265e52 Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Wed, 14 Sep 2016 10:12:23 +0200 Subject: [PATCH] Removed a graph optimization which increased the minDepth if a filter is defined on a higher depth. Under some circumstances this filter can be matched if the path is not long enough. --- arangod/Aql/TraversalNode.cpp | 6 ------ js/server/tests/aql/aql-graph-traverser.js | 22 ++++++++++++---------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/arangod/Aql/TraversalNode.cpp b/arangod/Aql/TraversalNode.cpp index d3acff5857..8c1ee075a0 100644 --- a/arangod/Aql/TraversalNode.cpp +++ b/arangod/Aql/TraversalNode.cpp @@ -936,9 +936,6 @@ void TraversalNode::prepareOptions() { auto ins = _options->_depthLookupInfo.emplace( it.first, std::vector()); // We probably have to adopt minDepth. We cannot fulfill a condition of larger depth anyway - if (_options->minDepth < it.first + 1) { - _options->minDepth = it.first + 1; - } TRI_ASSERT(ins.second); auto& infos = ins.first->second; infos.reserve(numEdgeColls); @@ -1007,9 +1004,6 @@ void TraversalNode::prepareOptions() { it.second->addMember(jt); } _options->_vertexExpressions.emplace(it.first, new Expression(ast, it.second)); - if (_options->minDepth < it.first) { - _options->minDepth = it.first; - } TRI_ASSERT(!_options->_vertexExpressions[it.first]->isV8()); } if (!_globalVertexConditions.empty()) { diff --git a/js/server/tests/aql/aql-graph-traverser.js b/js/server/tests/aql/aql-graph-traverser.js index 3b08537d82..b937e0ff72 100644 --- a/js/server/tests/aql/aql-graph-traverser.js +++ b/js/server/tests/aql/aql-graph-traverser.js @@ -1841,10 +1841,11 @@ function complexFilteringSuite () { // 1 Primary Lookups A -> D (D) // 0 Primary Lookups A -> B -> C // 0 Primary Lookups A -> B -> F - assertEqual(stats.scannedIndex, 12); + assertEqual(stats.scannedIndex, 13); } + // 2 Filter (B, C) too short // 2 Filter (E, G) - assertEqual(stats.filtered, 2); + assertEqual(stats.filtered, 4); }, testVertexLevelsCombined: function () { @@ -1868,7 +1869,7 @@ function complexFilteringSuite () { // 2 Primary lookup B,D // 2 Edge Lookups (0 B) (2 D) // 2 Primary Lookups (E, G) - assertEqual(stats.scannedIndex, 8); + assertEqual(stats.scannedIndex, 9); } else { // 2 Edge Lookups (A) @@ -1876,11 +1877,11 @@ function complexFilteringSuite () { // 2 Edge Lookups (0 B) (2 D) // 2 Primary Lookups for Eval (E, G) // 1 Primary Lookups A -> D - assertEqual(stats.scannedIndex, 8); + assertEqual(stats.scannedIndex, 9); } - // 1 Filter (B) + // 2 Filter (B, D) too short // 2 Filter (E, G) - assertEqual(stats.filtered, 3); + assertEqual(stats.filtered, 4); }, testEdgeLevel0: function () { @@ -1950,10 +1951,11 @@ function complexFilteringSuite () { // 1 Primary Lookups A -> D // 1 Primary Lookups A -> B -> C // 1 Primary Lookups A -> B -> F - assertEqual(stats.scannedIndex, 10); + assertEqual(stats.scannedIndex, 11); } + // 2 Filter On (B, D) too short // 2 Filter On (D->E, D->G) - assertEqual(stats.filtered, 2); + assertEqual(stats.filtered, 4); }, testVertexLevel1Less: function () { @@ -2969,7 +2971,7 @@ function optimizeQuantifierSuite() { let stats = cursor.getExtra().stats; assertEqual(stats.scannedFull, 0); assertEqual(stats.scannedIndex, 9); - assertEqual(stats.filtered, 2); + assertEqual(stats.filtered, 4); }, testAllEdgesAndDepth: function () { @@ -2992,7 +2994,7 @@ function optimizeQuantifierSuite() { } else { assertEqual(stats.scannedIndex, 7); } - assertEqual(stats.filtered, 2); + assertEqual(stats.filtered, 4); } }; };