From 14a130bb1973cf920e274a0655009ed761e31b30 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 2 Dec 2014 12:12:30 +0100 Subject: [PATCH] manual merge --- arangod/Aql/ExecutionBlock.cpp | 32 +++++++++++++++++++++++++++----- arangod/Aql/Expression.cpp | 6 +++--- arangod/Aql/Expression.h | 3 ++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/arangod/Aql/ExecutionBlock.cpp b/arangod/Aql/ExecutionBlock.cpp index 87d040501c..7c3198359c 100644 --- a/arangod/Aql/ExecutionBlock.cpp +++ b/arangod/Aql/ExecutionBlock.cpp @@ -1033,9 +1033,12 @@ bool IndexRangeBlock::initRanges () { // this constant range: for (auto l : r._lows) { Expression* e = _allVariableBoundExpressions[posInExpressions]; + TRI_ASSERT(e != nullptr); + TRI_document_collection_t const* myCollection = nullptr; AqlValue a = e->execute(_trx, docColls, data, nrRegs * _pos, _inVars[posInExpressions], - _inRegs[posInExpressions]); + _inRegs[posInExpressions], + &myCollection); posInExpressions++; if (a._type == AqlValue::JSON) { Json json(Json::Array, 3); @@ -1046,6 +1049,15 @@ bool IndexRangeBlock::initRanges () { RangeInfoBound b(json); // Construct from JSON actualRange._lowConst.andCombineLowerBounds(b); } + else if (a._type == AqlValue::SHAPED) { + Json json(Json::Array, 3); + json("include", Json(l.inclusive())) + ("isConstant", Json(true)) + ("bound", a.toJson(_trx, myCollection)); + a.destroy(); // the TRI_json_t* of a._json has been stolen + RangeInfoBound b(json); // Construct from JSON + actualRange._lowConst.andCombineLowerBounds(b); + } else { THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "AQL: computed a variable bound and got non-JSON"); @@ -1054,12 +1066,12 @@ bool IndexRangeBlock::initRanges () { for (auto h : r._highs) { Expression* e = _allVariableBoundExpressions[posInExpressions]; - + TRI_document_collection_t const* myCollection = nullptr; TRI_ASSERT(e != nullptr); - AqlValue a = e->execute(_trx, docColls, data, nrRegs * _pos, _inVars[posInExpressions], - _inRegs[posInExpressions]); + _inRegs[posInExpressions], + &myCollection); posInExpressions++; if (a._type == AqlValue::JSON) { Json json(Json::Array, 3); @@ -1070,6 +1082,15 @@ bool IndexRangeBlock::initRanges () { RangeInfoBound b(json); // Construct from JSON actualRange._highConst.andCombineUpperBounds(b); } + else if (a._type == AqlValue::SHAPED) { + Json json(Json::Array, 3); + json("include", Json(h.inclusive())) + ("isConstant", Json(true)) + ("bound", a.toJson(_trx, myCollection)); + a.destroy(); // the TRI_json_t* of a._json has been stolen + RangeInfoBound b(json); // Construct from JSON + actualRange._highConst.andCombineLowerBounds(b); + } else { THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "AQL: computed a variable bound and got non-JSON"); @@ -2094,7 +2115,8 @@ void CalculationBlock::doEvaluation (AqlItemBlock* result) { for (size_t i = 0; i < n; i++) { // need to execute the expression - AqlValue a = _expression->execute(_trx, docColls, data, nrRegs * i, _inVars, _inRegs); + TRI_document_collection_t const* myCollection = nullptr; + AqlValue a = _expression->execute(_trx, docColls, data, nrRegs * i, _inVars, _inRegs, &myCollection); try { result->setValue(i, _outReg, a); } diff --git a/arangod/Aql/Expression.cpp b/arangod/Aql/Expression.cpp index 7a994c8a91..e3946ecae5 100644 --- a/arangod/Aql/Expression.cpp +++ b/arangod/Aql/Expression.cpp @@ -118,7 +118,8 @@ AqlValue Expression::execute (triagens::arango::AqlTransaction* trx, std::vector& argv, size_t startPos, std::vector const& vars, - std::vector const& regs) { + std::vector const& regs, + TRI_document_collection_t const** collection) { if (! _built) { buildExpression(); @@ -155,8 +156,7 @@ AqlValue Expression::execute (triagens::arango::AqlTransaction* trx, } case SIMPLE: { - TRI_document_collection_t const* myCollection = nullptr; - return executeSimpleExpression(_node, &myCollection, trx, docColls, argv, startPos, vars, regs); + return executeSimpleExpression(_node, collection, trx, docColls, argv, startPos, vars, regs); } case UNPROCESSED: { diff --git a/arangod/Aql/Expression.h b/arangod/Aql/Expression.h index cc9ab17e60..849edb616c 100644 --- a/arangod/Aql/Expression.h +++ b/arangod/Aql/Expression.h @@ -166,7 +166,8 @@ namespace triagens { std::vector&, std::vector&, size_t, std::vector const&, - std::vector const&); + std::vector const&, + TRI_document_collection_t const**); //////////////////////////////////////////////////////////////////////////////// /// @brief check whether this is a simple expression