1
0
Fork 0

only clone complex AQL values in SortBlock and GatherBlock (#5253)

This commit is contained in:
Jan 2018-05-07 10:53:07 +02:00 committed by GitHub
parent b69b5bdfdf
commit 973220e1ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 83 additions and 61 deletions

View File

@ -342,6 +342,8 @@ AqlItemBlock* GatherBlock::getSome(size_t atMost) {
TRI_ASSERT(!_gatherBlockBuffer[val.first].empty());
AqlValue const& x(_gatherBlockBuffer[val.first].front()->getValueReference(val.second, col));
if (!x.isEmpty()) {
if (x.requiresDestruction()) {
// complex value, with ownership transfer
auto it = cache[val.first].find(x);
if (it == cache[val.first].end()) {
@ -356,6 +358,10 @@ AqlItemBlock* GatherBlock::getSome(size_t atMost) {
} else {
res->setValue(i, col, (*it).second);
}
} else {
// simple value, no ownership transfer needed
res->setValue(i, col, x);
}
}
}

View File

@ -331,6 +331,8 @@ void SortBlock::doSorting() {
// If we have already dealt with this value for the next
// block, then we just put the same value again:
if (!a.isEmpty()) {
if (a.requiresDestruction()) {
// complex value, with ownership transfer
auto it = cache.find(a);
if (it != cache.end()) {
@ -388,6 +390,20 @@ void SortBlock::doSorting() {
cache.emplace(a, a);
}
}
} else {
// simple value, which does not need ownership transfer
TRI_IF_FAILURE("SortBlock::doSortingCache") {
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
}
TRI_IF_FAILURE("SortBlock::doSortingNext1") {
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
}
TRI_IF_FAILURE("SortBlock::doSortingNext2") {
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
}
next->setValue(i, j, a);
_buffer[coords[count].first]->eraseValue(coords[count].second, j);
}
}
}
count++;