1
0
Fork 0

add initializeCursor back to DistinctCollectExecutor (#9386)

This commit is contained in:
Jan 2019-07-03 16:15:15 +02:00 committed by GitHub
parent 61f3397e33
commit 801c957348
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 6 deletions

View File

@ -64,12 +64,11 @@ DistinctCollectExecutor::DistinctCollectExecutor(Fetcher& fetcher, Infos& infos)
AqlValueGroupEqual(_infos.getTransaction())) {} AqlValueGroupEqual(_infos.getTransaction())) {}
DistinctCollectExecutor::~DistinctCollectExecutor() { DistinctCollectExecutor::~DistinctCollectExecutor() {
// destroy all AqlValues captured destroyValues();
for (auto& it : _seen) { }
for (auto& it2 : it) {
const_cast<AqlValue*>(&it2)->destroy(); void DistinctCollectExecutor::initializeCursor() {
} destroyValues();
}
} }
std::pair<ExecutionState, NoStats> DistinctCollectExecutor::produceRows(OutputAqlItemRow& output) { std::pair<ExecutionState, NoStats> DistinctCollectExecutor::produceRows(OutputAqlItemRow& output) {
@ -138,3 +137,13 @@ std::pair<ExecutionState, size_t> DistinctCollectExecutor::expectedNumberOfRows(
// but it is upper bounded by the input. // but it is upper bounded by the input.
return _fetcher.preFetchNumberOfRows(atMost); return _fetcher.preFetchNumberOfRows(atMost);
} }
void DistinctCollectExecutor::destroyValues() {
// destroy all AqlValues captured
for (auto& it : _seen) {
for (auto& it2 : it) {
const_cast<AqlValue*>(&it2)->destroy();
}
}
_seen.clear();
}

View File

@ -96,6 +96,8 @@ class DistinctCollectExecutor {
DistinctCollectExecutor(Fetcher& fetcher, Infos&); DistinctCollectExecutor(Fetcher& fetcher, Infos&);
~DistinctCollectExecutor(); ~DistinctCollectExecutor();
void initializeCursor();
/** /**
* @brief produce the next Row of Aql Values. * @brief produce the next Row of Aql Values.
* *
@ -107,6 +109,7 @@ class DistinctCollectExecutor {
private: private:
Infos const& infos() const noexcept { return _infos; }; Infos const& infos() const noexcept { return _infos; };
void destroyValues();
private: private:
Infos const& _infos; Infos const& _infos;

View File

@ -372,6 +372,9 @@ std::pair<ExecutionState, Result> ExecutionBlockImpl<Executor>::initializeCursor
static_assert(!std::is_same<Executor, IndexExecutor>::value || customInit, static_assert(!std::is_same<Executor, IndexExecutor>::value || customInit,
"IndexExecutor is expected to implement a custom " "IndexExecutor is expected to implement a custom "
"initializeCursor method!"); "initializeCursor method!");
static_assert(!std::is_same<Executor, DistinctCollectExecutor>::value || customInit,
"DistinctCollectExecutor is expected to implement a custom "
"initializeCursor method!");
InitializeCursor<customInit>::init(_executor, _rowFetcher, _infos); InitializeCursor<customInit>::init(_executor, _rowFetcher, _infos);
// // use this with c++17 instead of specialisation below // // use this with c++17 instead of specialisation below