1
0
Fork 0

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

Conflicts:
	arangod/Aql/ExecutionBlock.cpp
This commit is contained in:
Jan Steemann 2014-09-12 17:03:04 +02:00
commit 4f6f2ac34f
5 changed files with 103 additions and 28 deletions

View File

@ -864,11 +864,34 @@ IndexRangeBlock::IndexRangeBlock (ExecutionEngine* engine,
_allBoundsConstant &= r.isConstant();
}
}
IndexRangeBlock::~IndexRangeBlock () {
for (auto e : _allVariableBoundExpressions) {
delete e;
}
_allVariableBoundExpressions.clear();
}
int IndexRangeBlock::initialize () {
int res = ExecutionBlock::initialize();
if (res == TRI_ERROR_NO_ERROR) {
if (_trx->orderBarrier(_trx->trxCollection(_collection->cid())) == nullptr) {
res = TRI_ERROR_OUT_OF_MEMORY;
}
}
// Get the ranges from the node:
auto en = static_cast<IndexRangeNode const*>(getPlanNode());
std::vector<std::vector<RangeInfo>> const& orRanges = en->_ranges;
std::vector<RangeInfo> const& attrRanges = orRanges[0];
// instanciate expressions:
auto instanciateExpression = [&] (RangeInfoBound& b) -> void {
AstNode const* a = b.getExpressionAst(engine->getQuery()->ast());
AstNode const* a = b.getExpressionAst(_engine->getQuery()->ast());
// all new AstNodes are registered with the Ast in the Query
auto e = new Expression(engine->getQuery()->ast(), a);
auto e = new Expression(_engine->getQuery()->ast(), a);
try {
_allVariableBoundExpressions.push_back(e);
}
@ -910,13 +933,10 @@ IndexRangeBlock::IndexRangeBlock (ExecutionEngine* engine,
throw;
}
}
}
IndexRangeBlock::~IndexRangeBlock () {
for (auto e : _allVariableBoundExpressions) {
delete e;
else { // _allBoundsConstant
readIndex();
}
_allVariableBoundExpressions.clear();
return res;
}
bool IndexRangeBlock::readIndex () {
@ -1029,21 +1049,6 @@ bool IndexRangeBlock::readIndex () {
return (!_documents.empty());
}
int IndexRangeBlock::initialize () {
int res = ExecutionBlock::initialize();
if (res == TRI_ERROR_NO_ERROR) {
if (_trx->orderBarrier(_trx->trxCollection(_collection->cid())) == nullptr) {
res = TRI_ERROR_OUT_OF_MEMORY;
}
}
if (_allBoundsConstant) {
readIndex();
}
return res;
}
int IndexRangeBlock::initializeCursor (AqlItemBlock* items, size_t pos) {
int res = ExecutionBlock::initializeCursor(items, pos);
if (res != TRI_ERROR_NO_ERROR) {

View File

@ -747,7 +747,7 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
case EN::SORT:
case EN::INDEX_RANGE:
break;
case EN::ENUMERATE_COLLECTION:{
case EN::ENUMERATE_COLLECTION: {
auto node = static_cast<EnumerateCollectionNode*>(en);
auto var = node->getVariablesSetHere()[0]; // should only be 1
std::unordered_map<std::string, RangeInfo>* map
@ -759,7 +759,7 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
std::unordered_set<Variable const*> varsDefined
= node->getVarsValid();
for (auto x : *map) {
auto worker = [&] (std::vector<RangeInfoBound>& bounds) -> void {
auto worker = [&] (std::list<RangeInfoBound>& bounds) -> void {
for (auto it = bounds.begin(); it != bounds.end(); ++it) {
AstNode const* a = it->getExpressionAst(_plan->getAst());
std::unordered_set<Variable*> varsUsed

View File

@ -312,7 +312,7 @@ namespace triagens {
};
////////////////////////////////////////////////////////////////////////////////
/// @brief struct to keep a vector of RangeInfoBounds for _lows and one for
/// @brief struct to keep a list of RangeInfoBounds for _lows and one for
///_highs, as well as constant _lowConst and _highConst. All constant bounds
/// will be combined into _lowConst and _highConst respectively, they
/// can also be not _defined. All bounds in _lows and _highs are defined
@ -485,7 +485,7 @@ namespace triagens {
/// @brief _lows, all non-constant lower bounds
////////////////////////////////////////////////////////////////////////////////
std::vector<RangeInfoBound> _lows;
std::list<RangeInfoBound> _lows;
////////////////////////////////////////////////////////////////////////////////
/// @brief _lowConst, all constant lower bounds combined, or not _defined
@ -497,7 +497,7 @@ namespace triagens {
/// @brief _highs, all non-constant upper bounds
////////////////////////////////////////////////////////////////////////////////
std::vector<RangeInfoBound> _highs;
std::list<RangeInfoBound> _highs;
////////////////////////////////////////////////////////////////////////////////
/// @brief _highConst, all constant upper bounds combined, or not _defined

View File

@ -10,6 +10,9 @@ for i in $*; do
if test "$i" == valgrind; then
export VG='valgrind --log-file=/tmp/valgrindlog.%p --show-possibly-lost=no --track-fds=no --leak-check=full'
fi
if test "$i" == valgrindxml; then
export VG='valgrind --log-file=/tmp/valgrindlog.%p --show-possibly-lost=no --track-fds=no --leak-check=full'
fi
ARGS="$ARGS --javascript.script-parameter $i"
done
echo Database has its data in data-$PID

View File

@ -1,3 +1,62 @@
function resultsToXml(results) {
function xmlEscape(s) {
return s.replace(/[<>&"]/g, function (c) {
return "&"
+ { "<": "lt", ">": "gt", "&": "amp", "\"": "quot" }[c]
+ ";";
});
}
var xml = [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ];
xml.text = function (s) {
Array.prototype.push.call(this, s);
return this;
};
xml.elem = function (tagName, attrs, close) {
this.text("<").text(tagName);
for (var a in attrs || {}) {
this.text(" ").text(a).text("=\"")
.text(xmlEscape(String(attrs[a]))).text("\"");
}
close && this.text("/");
this.text(">\n");
return this;
};
xml.elem("testsuite", {
errors: 0,
failures: results.failed,
name: results.suiteName,
tests: results.total,
time: results.duration
});
for (var i in results.shell_server_aql) {
var result = results.shell_server_aql[i];
var success = (typeof(result) === 'boolean')? result : false;
xml.elem("testcase", {
name: i,
time: 0.0
}, success);
if (!success) {
xml.elem("failure", { message: result.message }, true)
.elem("/testcase");
}
}
xml.elem("/testsuite");
return xml.join("");
}
function main (argv) {
var fs = require("fs");
var print = require("internal").print;
@ -15,5 +74,13 @@ function main (argv) {
var r = UnitTest(test,options);
fs.write("UNITTEST_RESULT.json",JSON.stringify(r));
fs.write("UNITTEST_RESULT_SUMMARY.txt",JSON.stringify(r.all_ok));
try {
x = resultsToXml(r);
}
catch (x) {
print(x.message);
}
fs.write("UNITTEST_RESULT.xml", x);
print(r);
}