mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'aql-feature-index-or' of ssh://github.com/triAGENS/ArangoDB into aql-feature-index-or
This commit is contained in:
commit
d02102450c
|
@ -1033,9 +1033,12 @@ bool IndexRangeBlock::initRanges () {
|
||||||
// this constant range:
|
// this constant range:
|
||||||
for (auto l : r._lows) {
|
for (auto l : r._lows) {
|
||||||
Expression* e = _allVariableBoundExpressions[posInExpressions];
|
Expression* e = _allVariableBoundExpressions[posInExpressions];
|
||||||
|
TRI_ASSERT(e != nullptr);
|
||||||
|
TRI_document_collection_t const* myCollection = nullptr;
|
||||||
AqlValue a = e->execute(_trx, docColls, data, nrRegs * _pos,
|
AqlValue a = e->execute(_trx, docColls, data, nrRegs * _pos,
|
||||||
_inVars[posInExpressions],
|
_inVars[posInExpressions],
|
||||||
_inRegs[posInExpressions]);
|
_inRegs[posInExpressions],
|
||||||
|
&myCollection);
|
||||||
posInExpressions++;
|
posInExpressions++;
|
||||||
if (a._type == AqlValue::JSON) {
|
if (a._type == AqlValue::JSON) {
|
||||||
Json json(Json::Array, 3);
|
Json json(Json::Array, 3);
|
||||||
|
@ -1046,6 +1049,15 @@ bool IndexRangeBlock::initRanges () {
|
||||||
RangeInfoBound b(json); // Construct from JSON
|
RangeInfoBound b(json); // Construct from JSON
|
||||||
actualRange._lowConst.andCombineLowerBounds(b);
|
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 {
|
else {
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
||||||
"AQL: computed a variable bound and got non-JSON");
|
"AQL: computed a variable bound and got non-JSON");
|
||||||
|
@ -1054,12 +1066,12 @@ bool IndexRangeBlock::initRanges () {
|
||||||
|
|
||||||
for (auto h : r._highs) {
|
for (auto h : r._highs) {
|
||||||
Expression* e = _allVariableBoundExpressions[posInExpressions];
|
Expression* e = _allVariableBoundExpressions[posInExpressions];
|
||||||
|
TRI_document_collection_t const* myCollection = nullptr;
|
||||||
TRI_ASSERT(e != nullptr);
|
TRI_ASSERT(e != nullptr);
|
||||||
|
|
||||||
AqlValue a = e->execute(_trx, docColls, data, nrRegs * _pos,
|
AqlValue a = e->execute(_trx, docColls, data, nrRegs * _pos,
|
||||||
_inVars[posInExpressions],
|
_inVars[posInExpressions],
|
||||||
_inRegs[posInExpressions]);
|
_inRegs[posInExpressions],
|
||||||
|
&myCollection);
|
||||||
posInExpressions++;
|
posInExpressions++;
|
||||||
if (a._type == AqlValue::JSON) {
|
if (a._type == AqlValue::JSON) {
|
||||||
Json json(Json::Array, 3);
|
Json json(Json::Array, 3);
|
||||||
|
@ -1070,6 +1082,15 @@ bool IndexRangeBlock::initRanges () {
|
||||||
RangeInfoBound b(json); // Construct from JSON
|
RangeInfoBound b(json); // Construct from JSON
|
||||||
actualRange._highConst.andCombineUpperBounds(b);
|
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 {
|
else {
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
||||||
"AQL: computed a variable bound and got non-JSON");
|
"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++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
// need to execute the expression
|
// 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 {
|
try {
|
||||||
result->setValue(i, _outReg, a);
|
result->setValue(i, _outReg, a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,8 @@ AqlValue Expression::execute (triagens::arango::AqlTransaction* trx,
|
||||||
std::vector<AqlValue>& argv,
|
std::vector<AqlValue>& argv,
|
||||||
size_t startPos,
|
size_t startPos,
|
||||||
std::vector<Variable*> const& vars,
|
std::vector<Variable*> const& vars,
|
||||||
std::vector<RegisterId> const& regs) {
|
std::vector<RegisterId> const& regs,
|
||||||
|
TRI_document_collection_t const** collection) {
|
||||||
|
|
||||||
if (! _built) {
|
if (! _built) {
|
||||||
buildExpression();
|
buildExpression();
|
||||||
|
@ -155,8 +156,7 @@ AqlValue Expression::execute (triagens::arango::AqlTransaction* trx,
|
||||||
}
|
}
|
||||||
|
|
||||||
case SIMPLE: {
|
case SIMPLE: {
|
||||||
TRI_document_collection_t const* myCollection = nullptr;
|
return executeSimpleExpression(_node, collection, trx, docColls, argv, startPos, vars, regs);
|
||||||
return executeSimpleExpression(_node, &myCollection, trx, docColls, argv, startPos, vars, regs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case UNPROCESSED: {
|
case UNPROCESSED: {
|
||||||
|
|
|
@ -166,7 +166,8 @@ namespace triagens {
|
||||||
std::vector<TRI_document_collection_t const*>&,
|
std::vector<TRI_document_collection_t const*>&,
|
||||||
std::vector<AqlValue>&, size_t,
|
std::vector<AqlValue>&, size_t,
|
||||||
std::vector<Variable*> const&,
|
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
|
/// @brief check whether this is a simple expression
|
||||||
|
|
Loading…
Reference in New Issue