diff --git a/arangod/Aql/ExecutionBlock.cpp b/arangod/Aql/ExecutionBlock.cpp index fe88a70a24..44cf336bb2 100644 --- a/arangod/Aql/ExecutionBlock.cpp +++ b/arangod/Aql/ExecutionBlock.cpp @@ -114,12 +114,6 @@ void ExecutionBlock::staticAnalysis (ExecutionBlock* super) { sq->getSubquery()->staticAnalysis(s); } v->reset(); - // Now print the result: - for (auto it : _varOverview->varInfo) { - std::cout << "Variable ID:" << it.first << " RegisterId:" - << it.second.registerId << " Depth:" << it.second.depth - << std::endl; - } } // Local Variables: diff --git a/arangod/Aql/ExecutionBlock.h b/arangod/Aql/ExecutionBlock.h index df6e5552f4..8a6f12db4a 100644 --- a/arangod/Aql/ExecutionBlock.h +++ b/arangod/Aql/ExecutionBlock.h @@ -1013,6 +1013,58 @@ namespace triagens { return res; } +//////////////////////////////////////////////////////////////////////////////// +// skip between atLeast and atMost, returns the number actually skipped . . . +// will only return less than atLeast if there aren't atLeast many +// things to skip overall. +//////////////////////////////////////////////////////////////////////////////// + + size_t skipSome (size_t atLeast, size_t atMost) { + + size_t skipped = 0; + + if (_done) { + return skipped; + } + + while (skipped < atLeast) { + if (_buffer.empty()) { + if (! getBlock(DefaultBatchSize, DefaultBatchSize)) { + _done = true; + return skipped; + } + _pos = 0; // this is in the first block + _posInAllDocs = 0; // Note that we know _allDocs.size() > 0, + // otherwise _done would be true already + } + + // if we get here, then _buffer.front() exists + AqlItemBlock* cur = _buffer.front(); + + if (atMost > _documents.size() - _posInAllDocs) { + skipped += _documents.size() - _posInAllDocs; + _posInAllDocs = 0; + + // fetch more documents into our buffer + if (! moreDocuments()) { + // nothing more to read, re-initialize fetching of documents + initDocuments(); + if (++_pos >= cur->size()) { + _buffer.pop_front(); + delete cur; + _pos = 0; + } + } + } + else { + skipped = atMost; + _posInAllDocs += atMost; + } + } + return skipped; + } + + private: //////////////////////////////////////////////////////////////////////////////// @@ -1244,7 +1296,7 @@ namespace triagens { if (_buffer.empty()) { if (! getBlock(DefaultBatchSize, DefaultBatchSize)){ _done = true; - break; + return skipped; } _pos = 0; } @@ -1426,9 +1478,6 @@ namespace triagens { auto en = static_cast(getPlanNode()); std::unordered_set inVars = _expression->variables(); - for (auto it : inVars) { - std::cout << it->name << ":" << it->id << std::endl; - } for (auto it = inVars.begin(); it != inVars.end(); ++it) { _inVars.push_back(*it); diff --git a/lib/Basics/JsonHelper.h b/lib/Basics/JsonHelper.h index f2d1f8e074..8893d5c7df 100644 --- a/lib/Basics/JsonHelper.h +++ b/lib/Basics/JsonHelper.h @@ -582,7 +582,7 @@ namespace triagens { else { c._json = nullptr; } - c._autofree = AUTOFREE; + c._autofree = autofree; return c; }