mirror of https://gitee.com/bigwinds/arangodb
more bugfixes more tests
This commit is contained in:
parent
a7635abe41
commit
0dee54ee6f
|
@ -1153,18 +1153,30 @@ bool IndexRangeBlock::initRanges () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// the elements of the direct product of the collector are and
|
|
||||||
// conditions which should be added to newCondition
|
|
||||||
auto indexAnds = cartesian(collector);
|
|
||||||
|
|
||||||
if (newCondition != nullptr) {
|
bool isEmpty = false;
|
||||||
for (auto indexAnd: *indexAnds) {
|
for (auto x: collector) {
|
||||||
newCondition->push_back(indexAnd);
|
if (x.empty()) {
|
||||||
|
isEmpty = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
delete indexAnds;
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
newCondition = indexAnds;
|
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);
|
||||||
|
|
||||||
|
if (newCondition != nullptr) {
|
||||||
|
for (auto indexAnd: *indexAnds) {
|
||||||
|
newCondition->push_back(indexAnd);
|
||||||
|
}
|
||||||
|
delete indexAnds;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
newCondition = indexAnds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//_condition = newCondition.release();
|
//_condition = newCondition.release();
|
||||||
|
@ -1233,26 +1245,31 @@ IndexOrCondition* IndexRangeBlock::cartesian (
|
||||||
}
|
}
|
||||||
|
|
||||||
auto out = new IndexOrCondition();
|
auto out = new IndexOrCondition();
|
||||||
|
try {
|
||||||
while (true) {
|
|
||||||
IndexAndCondition next;
|
|
||||||
for (size_t i = 0; i < collector.size(); i++) {
|
|
||||||
next.push_back(collector[i][indexes[i]].clone());
|
|
||||||
}
|
|
||||||
out->push_back(next);
|
|
||||||
size_t j = collector.size() - 1;
|
|
||||||
while (true) {
|
while (true) {
|
||||||
indexes[j]++;
|
IndexAndCondition next;
|
||||||
if (indexes[j] < collector[j].size()) {
|
for (size_t i = 0; i < collector.size(); i++) {
|
||||||
break;
|
next.push_back(collector[i][indexes[i]].clone());
|
||||||
}
|
}
|
||||||
indexes[j] = 0;
|
out->push_back(next);
|
||||||
if (j == 0) {
|
size_t j = collector.size() - 1;
|
||||||
return out;
|
while (true) {
|
||||||
|
indexes[j]++;
|
||||||
|
if (indexes[j] < collector[j].size()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
indexes[j] = 0;
|
||||||
|
if (j == 0) {
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
j--;
|
||||||
}
|
}
|
||||||
j--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (...) {
|
||||||
|
delete out;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert the input rib into every ri in the IndexOrCondition . . .
|
// insert the input rib into every ri in the IndexOrCondition . . .
|
||||||
|
|
|
@ -1029,6 +1029,32 @@ function ahuacatlQueryOptimiserInTestSuite () {
|
||||||
ruleIsUsed(query);
|
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