1
0
Fork 0

Merge branch 'aql-feature-index-or' of ssh://github.com/triAGENS/ArangoDB into aql-feature-index-or

This commit is contained in:
James 2014-12-02 11:22:26 +00:00
commit d02102450c
3 changed files with 32 additions and 9 deletions

View File

@ -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);
}

View File

@ -118,7 +118,8 @@ AqlValue Expression::execute (triagens::arango::AqlTransaction* trx,
std::vector<AqlValue>& argv,
size_t startPos,
std::vector<Variable*> const& vars,
std::vector<RegisterId> const& regs) {
std::vector<RegisterId> 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: {

View File

@ -166,7 +166,8 @@ namespace triagens {
std::vector<TRI_document_collection_t const*>&,
std::vector<AqlValue>&, size_t,
std::vector<Variable*> const&,
std::vector<RegisterId> const&);
std::vector<RegisterId> const&,
TRI_document_collection_t const**);
////////////////////////////////////////////////////////////////////////////////
/// @brief check whether this is a simple expression