mirror of https://gitee.com/bigwinds/arangodb
more bugfixes more tests
This commit is contained in:
parent
a7635abe41
commit
0dee54ee6f
|
@ -1153,6 +1153,17 @@ bool IndexRangeBlock::initRanges () {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isEmpty = false;
|
||||
for (auto x: collector) {
|
||||
if (x.empty()) {
|
||||
isEmpty = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! isEmpty) {
|
||||
// otherwise the condition is impossible to fulfil
|
||||
// the elements of the direct product of the collector are and
|
||||
// conditions which should be added to newCondition
|
||||
auto indexAnds = cartesian(collector);
|
||||
|
@ -1167,6 +1178,7 @@ bool IndexRangeBlock::initRanges () {
|
|||
newCondition = indexAnds;
|
||||
}
|
||||
}
|
||||
}
|
||||
//_condition = newCondition.release();
|
||||
if (newCondition != nullptr) {
|
||||
freeCondition();
|
||||
|
@ -1233,7 +1245,7 @@ IndexOrCondition* IndexRangeBlock::cartesian (
|
|||
}
|
||||
|
||||
auto out = new IndexOrCondition();
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
IndexAndCondition next;
|
||||
for (size_t i = 0; i < collector.size(); i++) {
|
||||
|
@ -1253,6 +1265,11 @@ IndexOrCondition* IndexRangeBlock::cartesian (
|
|||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
delete out;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// insert the input rib into every ri in the IndexOrCondition . . .
|
||||
|
|
|
@ -1029,6 +1029,32 @@ function ahuacatlQueryOptimiserInTestSuite () {
|
|||
ruleIsUsed(query);
|
||||
},
|
||||
|
||||
//TODO add SORT here
|
||||
testSkiplistMoreThanOne6 : function () {
|
||||
|
||||
for (var i = 1;i <= 100;i++) {
|
||||
for (var j = 1; j <= 100; j++) {
|
||||
for (var k = 1; k <= 10; k++) {
|
||||
c.save({value1 : i, value2: j, value3: k,
|
||||
value4: 'somethings' + 2*j });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c.ensureSkiplist("value1", "value2", "value3", "value4");
|
||||
|
||||
var query = "FOR x IN " + cn + " FILTER (x.value1 IN [PASSTHRU(1), PASSTHRU(2), PASSTHRU(3)] && x.value1 IN PASSTHRU([2, 3, 4]) && x.value2 == PASSTHRU(10) && x.value3 <= 2) || (x.value1 == 1 && x.value2 == 2 && x.value3 >= 0 && x.value3 == PASSTHRU(6) && x.value4 in ['somethings2', PASSTHRU('somethings4')] ) RETURN [x.value1, x.value2, x.value3, x.value4]";
|
||||
var expected = [
|
||||
[ 2, 10, 1, "somethings20" ],
|
||||
[ 2, 10, 2, "somethings20" ],
|
||||
[ 3, 10, 1, "somethings20" ],
|
||||
[ 3, 10, 2, "somethings20" ],
|
||||
[ 1, 2, 6, "somethings4" ] ];
|
||||
var actual = getQueryResults(query);
|
||||
assertEqual(expected, actual);
|
||||
ruleIsUsed(query);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
Loading…
Reference in New Issue