mirror of https://gitee.com/bigwinds/arangodb
only clone complex AQL values in SortBlock and GatherBlock (#5253)
This commit is contained in:
parent
b69b5bdfdf
commit
973220e1ab
|
@ -342,6 +342,8 @@ AqlItemBlock* GatherBlock::getSome(size_t atMost) {
|
||||||
TRI_ASSERT(!_gatherBlockBuffer[val.first].empty());
|
TRI_ASSERT(!_gatherBlockBuffer[val.first].empty());
|
||||||
AqlValue const& x(_gatherBlockBuffer[val.first].front()->getValueReference(val.second, col));
|
AqlValue const& x(_gatherBlockBuffer[val.first].front()->getValueReference(val.second, col));
|
||||||
if (!x.isEmpty()) {
|
if (!x.isEmpty()) {
|
||||||
|
if (x.requiresDestruction()) {
|
||||||
|
// complex value, with ownership transfer
|
||||||
auto it = cache[val.first].find(x);
|
auto it = cache[val.first].find(x);
|
||||||
|
|
||||||
if (it == cache[val.first].end()) {
|
if (it == cache[val.first].end()) {
|
||||||
|
@ -356,6 +358,10 @@ AqlItemBlock* GatherBlock::getSome(size_t atMost) {
|
||||||
} else {
|
} else {
|
||||||
res->setValue(i, col, (*it).second);
|
res->setValue(i, col, (*it).second);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// simple value, no ownership transfer needed
|
||||||
|
res->setValue(i, col, x);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,6 +331,8 @@ void SortBlock::doSorting() {
|
||||||
// If we have already dealt with this value for the next
|
// If we have already dealt with this value for the next
|
||||||
// block, then we just put the same value again:
|
// block, then we just put the same value again:
|
||||||
if (!a.isEmpty()) {
|
if (!a.isEmpty()) {
|
||||||
|
if (a.requiresDestruction()) {
|
||||||
|
// complex value, with ownership transfer
|
||||||
auto it = cache.find(a);
|
auto it = cache.find(a);
|
||||||
|
|
||||||
if (it != cache.end()) {
|
if (it != cache.end()) {
|
||||||
|
@ -388,6 +390,20 @@ void SortBlock::doSorting() {
|
||||||
cache.emplace(a, a);
|
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++;
|
count++;
|
||||||
|
|
Loading…
Reference in New Issue