mirror of https://gitee.com/bigwinds/arangodb
attempt to speed up index queries
This commit is contained in:
parent
4dde92470f
commit
0fee6fd856
|
@ -812,7 +812,7 @@ IndexIterator* HashIndex::iteratorForCondition (IndexIteratorContext* context,
|
||||||
triagens::aql::Ast* ast,
|
triagens::aql::Ast* ast,
|
||||||
triagens::aql::AstNode const* node,
|
triagens::aql::AstNode const* node,
|
||||||
triagens::aql::Variable const* reference,
|
triagens::aql::Variable const* reference,
|
||||||
bool const reverse) const {
|
bool reverse) const {
|
||||||
TRI_ASSERT(node->type == aql::NODE_TYPE_OPERATOR_NARY_AND);
|
TRI_ASSERT(node->type == aql::NODE_TYPE_OPERATOR_NARY_AND);
|
||||||
|
|
||||||
SimpleAttributeEqualityMatcher matcher(fields());
|
SimpleAttributeEqualityMatcher matcher(fields());
|
||||||
|
@ -824,13 +824,17 @@ IndexIterator* HashIndex::iteratorForCondition (IndexIteratorContext* context,
|
||||||
std::vector<PermutationState> permutationStates;
|
std::vector<PermutationState> permutationStates;
|
||||||
permutationStates.reserve(n);
|
permutationStates.reserve(n);
|
||||||
size_t maxPermutations = 1;
|
size_t maxPermutations = 1;
|
||||||
|
|
||||||
|
std::pair<triagens::aql::Variable const*, std::vector<triagens::basics::AttributeName>> paramPair;
|
||||||
|
|
||||||
for (size_t i = 0; i < n; ++i) {
|
for (size_t i = 0; i < n; ++i) {
|
||||||
std::pair<triagens::aql::Variable const*, std::vector<triagens::basics::AttributeName>> paramPair;
|
|
||||||
auto comp = allVals->getMemberUnchecked(i);
|
auto comp = allVals->getMemberUnchecked(i);
|
||||||
auto attrNode = comp->getMember(0);
|
auto attrNode = comp->getMember(0);
|
||||||
auto valNode = comp->getMember(1);
|
auto valNode = comp->getMember(1);
|
||||||
|
|
||||||
|
paramPair.first = nullptr;
|
||||||
|
paramPair.second.clear();
|
||||||
|
|
||||||
if (! attrNode->isAttributeAccessForVariable(paramPair) || paramPair.first != reference) {
|
if (! attrNode->isAttributeAccessForVariable(paramPair) || paramPair.first != reference) {
|
||||||
attrNode = comp->getMember(1);
|
attrNode = comp->getMember(1);
|
||||||
valNode = comp->getMember(0);
|
valNode = comp->getMember(0);
|
||||||
|
|
|
@ -192,7 +192,7 @@ namespace triagens {
|
||||||
triagens::aql::Ast*,
|
triagens::aql::Ast*,
|
||||||
triagens::aql::AstNode const*,
|
triagens::aql::AstNode const*,
|
||||||
triagens::aql::Variable const*,
|
triagens::aql::Variable const*,
|
||||||
bool const) const override;
|
bool) const override;
|
||||||
|
|
||||||
triagens::aql::AstNode* specializeCondition (triagens::aql::AstNode*,
|
triagens::aql::AstNode* specializeCondition (triagens::aql::AstNode*,
|
||||||
triagens::aql::Variable const*) const override;
|
triagens::aql::Variable const*) const override;
|
||||||
|
|
|
@ -553,7 +553,8 @@ triagens::aql::AstNode* Index::specializeCondition (triagens::aql::AstNode* node
|
||||||
bool Index::canUseConditionPart (triagens::aql::AstNode const* access,
|
bool Index::canUseConditionPart (triagens::aql::AstNode const* access,
|
||||||
triagens::aql::AstNode const* other,
|
triagens::aql::AstNode const* other,
|
||||||
triagens::aql::AstNode const* op,
|
triagens::aql::AstNode const* op,
|
||||||
triagens::aql::Variable const* reference) const {
|
triagens::aql::Variable const* reference,
|
||||||
|
bool isExecution) const {
|
||||||
|
|
||||||
if (_sparse) {
|
if (_sparse) {
|
||||||
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_NIN) {
|
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_NIN) {
|
||||||
|
@ -614,6 +615,11 @@ bool Index::canUseConditionPart (triagens::aql::AstNode const* access,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isExecution) {
|
||||||
|
// in execution phase, we do not need to check the variable usage again
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// test if the reference variable is contained on both side of the expression
|
// test if the reference variable is contained on both side of the expression
|
||||||
std::unordered_set<aql::Variable const*> variables;
|
std::unordered_set<aql::Variable const*> variables;
|
||||||
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN &&
|
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN &&
|
||||||
|
|
|
@ -370,7 +370,8 @@ namespace triagens {
|
||||||
bool canUseConditionPart (triagens::aql::AstNode const* access,
|
bool canUseConditionPart (triagens::aql::AstNode const* access,
|
||||||
triagens::aql::AstNode const* other,
|
triagens::aql::AstNode const* other,
|
||||||
triagens::aql::AstNode const* op,
|
triagens::aql::AstNode const* op,
|
||||||
triagens::aql::Variable const* reference) const;
|
triagens::aql::Variable const* reference,
|
||||||
|
bool) const;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- protected variables
|
// --SECTION-- protected variables
|
||||||
|
|
|
@ -72,8 +72,8 @@ bool SimpleAttributeEqualityMatcher::matchOne (triagens::arango::Index const* in
|
||||||
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
// EQ is symmetric
|
// EQ is symmetric
|
||||||
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference) ||
|
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference, false) ||
|
||||||
accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference)) {
|
accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference, false)) {
|
||||||
// we can use the index
|
// we can use the index
|
||||||
calculateIndexCosts(index, itemsInIndex, estimatedItems, estimatedCost);
|
calculateIndexCosts(index, itemsInIndex, estimatedItems, estimatedCost);
|
||||||
return true;
|
return true;
|
||||||
|
@ -81,7 +81,7 @@ bool SimpleAttributeEqualityMatcher::matchOne (triagens::arango::Index const* in
|
||||||
}
|
}
|
||||||
else if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
else if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference)) {
|
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference, false)) {
|
||||||
// we can use the index
|
// we can use the index
|
||||||
// use slightly different cost calculation for IN that for EQ
|
// use slightly different cost calculation for IN that for EQ
|
||||||
calculateIndexCosts(index, itemsInIndex, estimatedItems, estimatedCost);
|
calculateIndexCosts(index, itemsInIndex, estimatedItems, estimatedCost);
|
||||||
|
@ -118,8 +118,8 @@ bool SimpleAttributeEqualityMatcher::matchAll (triagens::arango::Index const* in
|
||||||
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
|
|
||||||
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference) ||
|
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference, false) ||
|
||||||
accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference)) {
|
accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference, false)) {
|
||||||
if (_found.size() == _attributes.size()) {
|
if (_found.size() == _attributes.size()) {
|
||||||
// got enough attributes
|
// got enough attributes
|
||||||
break;
|
break;
|
||||||
|
@ -129,7 +129,7 @@ bool SimpleAttributeEqualityMatcher::matchAll (triagens::arango::Index const* in
|
||||||
else if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
else if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
|
|
||||||
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference)) {
|
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference, false)) {
|
||||||
auto m = op->getMember(1);
|
auto m = op->getMember(1);
|
||||||
if (m->type != triagens::aql::NODE_TYPE_EXPANSION && m->numMembers() > 1) {
|
if (m->type != triagens::aql::NODE_TYPE_EXPANSION && m->numMembers() > 1) {
|
||||||
// attr IN [ a, b, c ] => this will produce multiple items, so count them!
|
// attr IN [ a, b, c ] => this will produce multiple items, so count them!
|
||||||
|
@ -182,10 +182,10 @@ triagens::aql::AstNode* SimpleAttributeEqualityMatcher::getOne (triagens::aql::A
|
||||||
op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
// note: accessFitsIndex will increase _found in case of a condition match
|
// note: accessFitsIndex will increase _found in case of a condition match
|
||||||
bool matches = accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference);
|
bool matches = accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference, true);
|
||||||
|
|
||||||
if (! matches && op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
if (! matches && op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
||||||
matches = accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference);
|
matches = accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matches) {
|
if (matches) {
|
||||||
|
@ -223,11 +223,11 @@ triagens::aql::AstNode* SimpleAttributeEqualityMatcher::getAll (triagens::aql::A
|
||||||
op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
// note: accessFitsIndex will increase _found in case of a condition match
|
// note: accessFitsIndex will increase _found in case of a condition match
|
||||||
bool matches = accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference);
|
bool matches = accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference, true);
|
||||||
|
|
||||||
if (! matches && op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
if (! matches && op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
||||||
// EQ is symmetric
|
// EQ is symmetric
|
||||||
matches = accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference);
|
matches = accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matches) {
|
if (matches) {
|
||||||
|
@ -238,14 +238,14 @@ triagens::aql::AstNode* SimpleAttributeEqualityMatcher::getAll (triagens::aql::A
|
||||||
|
|
||||||
if (_found.size() == _attributes.size()) {
|
if (_found.size() == _attributes.size()) {
|
||||||
// got enough matches
|
// got enough matches
|
||||||
std::unique_ptr<triagens::aql::AstNode> node(ast->createNodeNaryOperator(triagens::aql::NODE_TYPE_OPERATOR_NARY_AND));
|
auto node = ast->createNodeNaryOperator(triagens::aql::NODE_TYPE_OPERATOR_NARY_AND);
|
||||||
|
|
||||||
for (auto& it : parts) {
|
for (auto& it : parts) {
|
||||||
node->addMember(ast->clone(it));
|
node->addMember(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
// done
|
// done
|
||||||
return node.release();
|
return node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,8 +274,8 @@ triagens::aql::AstNode* SimpleAttributeEqualityMatcher::specializeOne (triagens:
|
||||||
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
// EQ is symmetric
|
// EQ is symmetric
|
||||||
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference) ||
|
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference, false) ||
|
||||||
accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference)) {
|
accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference, false)) {
|
||||||
// we can use the index
|
// we can use the index
|
||||||
// now return only the child node we need
|
// now return only the child node we need
|
||||||
while (node->numMembers() > 0) {
|
while (node->numMembers() > 0) {
|
||||||
|
@ -289,7 +289,7 @@ triagens::aql::AstNode* SimpleAttributeEqualityMatcher::specializeOne (triagens:
|
||||||
else if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
else if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
|
|
||||||
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference)) {
|
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference, false)) {
|
||||||
// we can use the index
|
// we can use the index
|
||||||
// now return only the child node we need
|
// now return only the child node we need
|
||||||
while (node->numMembers() > 0) {
|
while (node->numMembers() > 0) {
|
||||||
|
@ -325,8 +325,8 @@ triagens::aql::AstNode* SimpleAttributeEqualityMatcher::specializeAll (triagens:
|
||||||
|
|
||||||
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_EQ) {
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference) ||
|
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference, false) ||
|
||||||
accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference)) {
|
accessFitsIndex(index, op->getMember(1), op->getMember(0), op, reference, false)) {
|
||||||
children.emplace_back(op);
|
children.emplace_back(op);
|
||||||
TRI_IF_FAILURE("SimpleAttributeMatcher::specializeAllChildrenEQ") {
|
TRI_IF_FAILURE("SimpleAttributeMatcher::specializeAllChildrenEQ") {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
|
||||||
|
@ -339,7 +339,7 @@ triagens::aql::AstNode* SimpleAttributeEqualityMatcher::specializeAll (triagens:
|
||||||
}
|
}
|
||||||
else if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
else if (op->type == triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN) {
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference)) {
|
if (accessFitsIndex(index, op->getMember(0), op->getMember(1), op, reference, false)) {
|
||||||
children.emplace_back(op);
|
children.emplace_back(op);
|
||||||
TRI_IF_FAILURE("SimpleAttributeMatcher::specializeAllChildrenIN") {
|
TRI_IF_FAILURE("SimpleAttributeMatcher::specializeAllChildrenIN") {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
|
||||||
|
@ -433,8 +433,9 @@ bool SimpleAttributeEqualityMatcher::accessFitsIndex (triagens::arango::Index co
|
||||||
triagens::aql::AstNode const* access,
|
triagens::aql::AstNode const* access,
|
||||||
triagens::aql::AstNode const* other,
|
triagens::aql::AstNode const* other,
|
||||||
triagens::aql::AstNode const* op,
|
triagens::aql::AstNode const* op,
|
||||||
triagens::aql::Variable const* reference) {
|
triagens::aql::Variable const* reference,
|
||||||
if (! index->canUseConditionPart(access, other, op, reference)) {
|
bool isExecution) {
|
||||||
|
if (! index->canUseConditionPart(access, other, op, reference, isExecution)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,8 @@ namespace triagens {
|
||||||
triagens::aql::AstNode const*,
|
triagens::aql::AstNode const*,
|
||||||
triagens::aql::AstNode const*,
|
triagens::aql::AstNode const*,
|
||||||
triagens::aql::AstNode const*,
|
triagens::aql::AstNode const*,
|
||||||
triagens::aql::Variable const*);
|
triagens::aql::Variable const*,
|
||||||
|
bool);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- private variables
|
// --SECTION-- private variables
|
||||||
|
|
|
@ -1047,8 +1047,9 @@ bool SkiplistIndex::accessFitsIndex (triagens::aql::AstNode const* access,
|
||||||
triagens::aql::AstNode const* other,
|
triagens::aql::AstNode const* other,
|
||||||
triagens::aql::AstNode const* op,
|
triagens::aql::AstNode const* op,
|
||||||
triagens::aql::Variable const* reference,
|
triagens::aql::Variable const* reference,
|
||||||
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>>& found) const {
|
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>>& found,
|
||||||
if (! this->canUseConditionPart(access, other, op, reference)) {
|
bool isExecution) const {
|
||||||
|
if (! this->canUseConditionPart(access, other, op, reference, isExecution)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1100,7 +1101,8 @@ bool SkiplistIndex::accessFitsIndex (triagens::aql::AstNode const* access,
|
||||||
void SkiplistIndex::matchAttributes (triagens::aql::AstNode const* node,
|
void SkiplistIndex::matchAttributes (triagens::aql::AstNode const* node,
|
||||||
triagens::aql::Variable const* reference,
|
triagens::aql::Variable const* reference,
|
||||||
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>>& found,
|
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>>& found,
|
||||||
size_t& values) const {
|
size_t& values,
|
||||||
|
bool isExecution) const {
|
||||||
for (size_t i = 0; i < node->numMembers(); ++i) {
|
for (size_t i = 0; i < node->numMembers(); ++i) {
|
||||||
auto op = node->getMember(i);
|
auto op = node->getMember(i);
|
||||||
|
|
||||||
|
@ -1111,12 +1113,12 @@ void SkiplistIndex::matchAttributes (triagens::aql::AstNode const* node,
|
||||||
case triagens::aql::NODE_TYPE_OPERATOR_BINARY_GT:
|
case triagens::aql::NODE_TYPE_OPERATOR_BINARY_GT:
|
||||||
case triagens::aql::NODE_TYPE_OPERATOR_BINARY_GE:
|
case triagens::aql::NODE_TYPE_OPERATOR_BINARY_GE:
|
||||||
TRI_ASSERT(op->numMembers() == 2);
|
TRI_ASSERT(op->numMembers() == 2);
|
||||||
accessFitsIndex(op->getMember(0), op->getMember(1), op, reference, found);
|
accessFitsIndex(op->getMember(0), op->getMember(1), op, reference, found, isExecution);
|
||||||
accessFitsIndex(op->getMember(1), op->getMember(0), op, reference, found);
|
accessFitsIndex(op->getMember(1), op->getMember(0), op, reference, found, isExecution);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN:
|
case triagens::aql::NODE_TYPE_OPERATOR_BINARY_IN:
|
||||||
if (accessFitsIndex(op->getMember(0), op->getMember(1), op, reference, found)) {
|
if (accessFitsIndex(op->getMember(0), op->getMember(1), op, reference, found, isExecution)) {
|
||||||
auto m = op->getMember(1);
|
auto m = op->getMember(1);
|
||||||
if (m->type != triagens::aql::NODE_TYPE_EXPANSION && m->numMembers() > 1) {
|
if (m->type != triagens::aql::NODE_TYPE_EXPANSION && m->numMembers() > 1) {
|
||||||
// attr IN [ a, b, c ] => this will produce multiple items, so count them!
|
// attr IN [ a, b, c ] => this will produce multiple items, so count them!
|
||||||
|
@ -1124,7 +1126,7 @@ void SkiplistIndex::matchAttributes (triagens::aql::AstNode const* node,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
accessFitsIndex(op->getMember(1), op->getMember(0), op, reference, found);
|
accessFitsIndex(op->getMember(1), op->getMember(0), op, reference, found, isExecution);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1141,7 +1143,7 @@ bool SkiplistIndex::supportsFilterCondition (triagens::aql::AstNode const* node,
|
||||||
double& estimatedCost) const {
|
double& estimatedCost) const {
|
||||||
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>> found;
|
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>> found;
|
||||||
size_t values = 0;
|
size_t values = 0;
|
||||||
matchAttributes(node, reference, found, values);
|
matchAttributes(node, reference, found, values, false);
|
||||||
|
|
||||||
bool lastContainsEquality = true;
|
bool lastContainsEquality = true;
|
||||||
size_t attributesCovered = 0;
|
size_t attributesCovered = 0;
|
||||||
|
@ -1276,7 +1278,7 @@ IndexIterator* SkiplistIndex::iteratorForCondition (IndexIteratorContext* contex
|
||||||
triagens::aql::Ast* ast,
|
triagens::aql::Ast* ast,
|
||||||
triagens::aql::AstNode const* node,
|
triagens::aql::AstNode const* node,
|
||||||
triagens::aql::Variable const* reference,
|
triagens::aql::Variable const* reference,
|
||||||
bool const reverse) const {
|
bool reverse) const {
|
||||||
|
|
||||||
// Create the skiplistOperator for the IndexLookup
|
// Create the skiplistOperator for the IndexLookup
|
||||||
if (node == nullptr) {
|
if (node == nullptr) {
|
||||||
|
@ -1295,7 +1297,7 @@ IndexIterator* SkiplistIndex::iteratorForCondition (IndexIteratorContext* contex
|
||||||
}
|
}
|
||||||
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>> found;
|
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>> found;
|
||||||
size_t unused = 0;
|
size_t unused = 0;
|
||||||
matchAttributes(node, reference, found, unused);
|
matchAttributes(node, reference, found, unused, true);
|
||||||
|
|
||||||
// found contains all attributes that are relevant for this node.
|
// found contains all attributes that are relevant for this node.
|
||||||
// It might be less than fields().
|
// It might be less than fields().
|
||||||
|
@ -1537,7 +1539,7 @@ triagens::aql::AstNode* SkiplistIndex::specializeCondition (triagens::aql::AstNo
|
||||||
triagens::aql::Variable const* reference) const {
|
triagens::aql::Variable const* reference) const {
|
||||||
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>> found;
|
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>> found;
|
||||||
size_t values = 0;
|
size_t values = 0;
|
||||||
matchAttributes(node, reference, found, values);
|
matchAttributes(node, reference, found, values, false);
|
||||||
|
|
||||||
std::vector<triagens::aql::AstNode const*> children;
|
std::vector<triagens::aql::AstNode const*> children;
|
||||||
bool lastContainsEquality = true;
|
bool lastContainsEquality = true;
|
||||||
|
|
|
@ -319,7 +319,7 @@ namespace triagens {
|
||||||
triagens::aql::Ast*,
|
triagens::aql::Ast*,
|
||||||
triagens::aql::AstNode const*,
|
triagens::aql::AstNode const*,
|
||||||
triagens::aql::Variable const*,
|
triagens::aql::Variable const*,
|
||||||
bool const) const override;
|
bool) const override;
|
||||||
|
|
||||||
triagens::aql::AstNode* specializeCondition (triagens::aql::AstNode*,
|
triagens::aql::AstNode* specializeCondition (triagens::aql::AstNode*,
|
||||||
triagens::aql::Variable const*) const override;
|
triagens::aql::Variable const*) const override;
|
||||||
|
@ -344,12 +344,14 @@ namespace triagens {
|
||||||
triagens::aql::AstNode const*,
|
triagens::aql::AstNode const*,
|
||||||
triagens::aql::AstNode const*,
|
triagens::aql::AstNode const*,
|
||||||
triagens::aql::Variable const*,
|
triagens::aql::Variable const*,
|
||||||
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>>&) const;
|
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>>&,
|
||||||
|
bool) const;
|
||||||
|
|
||||||
void matchAttributes (triagens::aql::AstNode const*,
|
void matchAttributes (triagens::aql::AstNode const*,
|
||||||
triagens::aql::Variable const*,
|
triagens::aql::Variable const*,
|
||||||
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>>&,
|
std::unordered_map<size_t, std::vector<triagens::aql::AstNode const*>>&,
|
||||||
size_t&) const;
|
size_t&,
|
||||||
|
bool) const;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- private variables
|
// --SECTION-- private variables
|
||||||
|
|
Loading…
Reference in New Issue