1
0
Fork 0

fixed issue #5977: Unexpected execution plan when subquery contains COLLECT (#5983)

This commit is contained in:
Jan 2018-07-25 17:33:45 +02:00 committed by GitHub
parent 9b28232b12
commit e266efdf96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -1,6 +1,8 @@
v3.3.13 (XXXX-XX-XX)
--------------------
* fixed issue #5977: Unexpected execution plan when subquery contains COLLECT
* Bugfix: The AQL syntax variants `UPDATE/REPLACE k WITH d` now correctly take
_rev from k instead of d (when ignoreRevs is false) and ignore d._rev.

View File

@ -973,6 +973,9 @@ int DistinctCollectBlock::getOrSkipSome(size_t atLeast, size_t atMost,
if (!skipping) {
size_t i = 0;
for (auto& it : _groupRegisters) {
if (skipped > 0) {
res->copyValuesFromFirstRow(skipped, static_cast<RegisterId>(cur->getNrRegs()));
}
res->setValue(skipped, it.first, groupValues[i].clone());
++i;
}

View File

@ -208,6 +208,17 @@ function ahuacatlDistinct () {
assertEqual(100, strings.length);
},
testDistinctInOptimizedAwaySubquery : function () {
let query = "LET values = (FOR i IN " + c.name() + " RETURN DISTINCT i.value1) FOR doc IN values RETURN 42";
containsDistinct(query);
let result = AQL_EXECUTE(query).json;
assertEqual(100, result.length);
let plan = AQL_EXPLAIN(query).plan;
assertNotEqual(-1, plan.rules.indexOf("inline-subqueries"));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief distinct usage
////////////////////////////////////////////////////////////////////////////////