1
0
Fork 0

Merge branch 'aql2' of github.com:triAGENS/ArangoDB into aql2

This commit is contained in:
Willi Goesgens 2014-08-12 17:11:06 +02:00
commit a809b58541
2 changed files with 35 additions and 10 deletions

View File

@ -1085,7 +1085,7 @@ namespace triagens {
// if we get here, then _buffer.front() exists
AqlItemBlock* cur = _buffer.front();
if (atMost > _documents.size() - _posInAllDocs) {
if (atMost >= skipped + _documents.size() - _posInAllDocs) {
skipped += _documents.size() - _posInAllDocs;
_posInAllDocs = 0;
@ -1101,8 +1101,8 @@ namespace triagens {
}
}
else {
_posInAllDocs += atMost - skipped;
skipped = atMost;
_posInAllDocs += atMost;
}
}
return skipped;
@ -1183,8 +1183,8 @@ namespace triagens {
// get the inVariable register id . . .
// staticAnalysis has been run, so _varOverview is set up
auto it = _varOverview->varInfo.find(en->_inVariable->id);
if (it == _varOverview->varInfo.end()){
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "variable not found");
}
@ -1224,7 +1224,7 @@ namespace triagens {
}
AqlItemBlock* res;
do {
// repeatedly try to get more stuff from upstream
// note that the value of the variable we have to loop over
@ -1257,25 +1257,36 @@ namespace triagens {
sizeInVar = inVarReg._json->size();
break;
}
case AqlValue::RANGE: {
sizeInVar = inVarReg._range->_high - inVarReg._range->_low + 1;
sizeInVar = inVarReg._range->size();
break;
}
case AqlValue::DOCVEC: {
if( _index == 0) { // this is a (maybe) new DOCVEC
_DOCVECsize = 0;
//we require the total number of items
for (size_t i = 0; i < inVarReg._vector->size(); i++) {
_DOCVECsize += inVarReg._vector->at(i)->size();
}
collection = inVarReg._vector->at(0)->getDocumentCollection(0);
}
sizeInVar = _DOCVECsize;
if (sizeInVar > 0) {
collection = inVarReg._vector->at(0)->getDocumentCollection(0);
}
break;
}
default: {
case AqlValue::SHAPED: {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
"EnumerateListBlock: unexpected type in register");
"EnumerateListBlock: cannot iterate over shaped value");
}
case AqlValue::EMPTY: {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
"EnumerateListBlock: cannot iterate over empty value");
}
}
@ -1428,10 +1439,15 @@ namespace triagens {
}
return out;
}
default: {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unexpected value in variable to iterate over");
case AqlValue::SHAPED:
case AqlValue::EMPTY: {
// error
break;
}
}
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unexpected value in variable to iterate over");
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -49,6 +49,15 @@ namespace triagens {
: _low(low),
_high(high) {
}
size_t size () const {
if (_low <= _high) {
// e.g. 1..1, 1..10 etc.
return _high - _low + 1;
}
// e.g. 10..1
return _low - _high + 1;
}
int64_t const _low;
int64_t const _high;