From 404f725461e44097616dbfb917f3fdc97bbdf244 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Thu, 8 Oct 2015 17:43:37 +0200 Subject: [PATCH] minor fixes --- arangod/Aql/IndexBlock.cpp | 26 +++++++++++--------------- arangod/Aql/IndexBlock.h | 9 ++++----- arangod/Aql/IndexNode.h | 4 ++-- arangod/Indexes/HashIndex.cpp | 12 ++++++------ 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/arangod/Aql/IndexBlock.cpp b/arangod/Aql/IndexBlock.cpp index 68bfef9ce6..e8d937e52c 100644 --- a/arangod/Aql/IndexBlock.cpp +++ b/arangod/Aql/IndexBlock.cpp @@ -120,30 +120,26 @@ int IndexBlock::initialize () { // instantiate expressions: auto instantiateExpression = [&] (size_t i, size_t j, size_t k, AstNode const* a) -> void { - Expression* expression = nullptr; - - { - // all new AstNodes are registered with the Ast in the Query - std::unique_ptr e(new Expression(_engine->getQuery()->ast(), a)); + // all new AstNodes are registered with the Ast in the Query + std::unique_ptr e(new Expression(_engine->getQuery()->ast(), a)); - TRI_IF_FAILURE("IndexBlock::initialize") { - THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG); - } - - _hasV8Expression |= e->isV8(); - _nonConstExpressions.emplace_back(i, j, k, e.get()); - expression = e.release(); + TRI_IF_FAILURE("IndexBlock::initialize") { + THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG); } + _hasV8Expression |= e->isV8(); + _nonConstExpressions.emplace_back(i, j, k, e.get()); + + std::unordered_set inVars; + e->variables(inVars); + e.release(); + // Prepare _inVars and _inRegs: _inVars.emplace_back(); std::vector& inVarsCur = _inVars.back(); _inRegs.emplace_back(); std::vector& inRegsCur = _inRegs.back(); - std::unordered_set inVars; - expression->variables(inVars); - for (auto const& v : inVars) { inVarsCur.emplace_back(v); auto it = getPlanNode()->getRegisterPlan()->varInfo.find(v->id); diff --git a/arangod/Aql/IndexBlock.h b/arangod/Aql/IndexBlock.h index 0e02d6e760..a35ddd0946 100644 --- a/arangod/Aql/IndexBlock.h +++ b/arangod/Aql/IndexBlock.h @@ -65,11 +65,10 @@ namespace triagens { size_t const operatorMember; Expression* expression; - NonConstExpression ( - size_t const orM, - size_t const andM, - size_t const opM, - Expression* exp) + NonConstExpression (size_t orM, + size_t andM, + size_t opM, + Expression* exp) : orMember(orM), andMember(andM), operatorMember(opM), diff --git a/arangod/Aql/IndexNode.h b/arangod/Aql/IndexNode.h index 51bd222c62..58aa607e4a 100644 --- a/arangod/Aql/IndexNode.h +++ b/arangod/Aql/IndexNode.h @@ -62,7 +62,7 @@ namespace triagens { Collection const* collection, Variable const* outVariable, std::vector indexes, - Condition const* condition, + Condition* condition, bool reverse) : ExecutionNode(plan, id), _vocbase(vocbase), @@ -198,7 +198,7 @@ namespace triagens { /// @brief the index(es) condition //////////////////////////////////////////////////////////////////////////////// - Condition const* _condition; + Condition* _condition; //////////////////////////////////////////////////////////////////////////////// /// @brief the index sort order - this is the same order for all indexes diff --git a/arangod/Indexes/HashIndex.cpp b/arangod/Indexes/HashIndex.cpp index 3b998128b9..6ba0eda8ba 100644 --- a/arangod/Indexes/HashIndex.cpp +++ b/arangod/Indexes/HashIndex.cpp @@ -123,16 +123,16 @@ static bool IsEqualKeyElementHash (TRI_hash_index_search_value_t const* left, TRI_doc_mptr_t* HashIndexIterator::next () { while (true) { - if (_position >= _keys.size()) { - // we're at the end of the lookup values - return nullptr; - } - if (_posInBuffer >= _buffer.size()) { + if (_position >= _keys.size()) { + // we're at the end of the lookup values + return nullptr; + } + // We have to refill the buffer _buffer.clear(); - _posInBuffer = 0; + int res = _index->lookup(_keys[_position++], _buffer); if (res != TRI_ERROR_NO_ERROR) {