8000 add initializeCursor back to DistinctCollectExecutor by jsteemann · Pull Request #9386 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

add initializeCursor back to DistinctCollectExecutor #9386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions arangod/Aql/DistinctCollectExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ DistinctCollectExecutor::DistinctCollectExecutor(Fetcher& fetcher, Infos& infos)
AqlValueGroupEqual(_infos.getTransaction())) {}

DistinctCollectExecutor::~DistinctCollectExecutor() {
// destroy all AqlValues captured
for (auto& it : _seen) {
for (auto& it2 : it) {
const_cast<AqlValue*>(&it2)->destroy();
}
}
destroyValues();
}

void DistinctCollectExecutor::initializeCursor() {
destroyValues();
}

std::pair<ExecutionState, NoStats> DistinctCollectExecutor::produceRows(OutputAqlItemRow& output) {
Expand Down Expand Up @@ -138,3 +137,13 @@ std::pair<ExecutionState, size_t> DistinctCollectExecutor::expectedNumberOfRows(
// but it is upper bounded by the input.
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();
}
3 changes: 3 additions & 0 deletions arangod/Aql/DistinctCollectExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class DistinctCollectExecutor {
DistinctCollectExecutor(DistinctCollectExecutor const&) = delete;
DistinctCollectExecutor(Fetcher& fetcher, Infos&);
~DistinctCollectExecutor();

void initializeCursor();

/**
* @brief produce the next Row of Aql Values.
Expand All @@ -107,6 +109,7 @@ class DistinctCollectExecutor {

private:
Infos const& infos() const noexcept { return _infos; };
void destroyValues();

private:
Infos const& _infos;
Expand Down
3 changes: 3 additions & 0 deletions arangod/Aql/ExecutionBlockImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ std::pair<ExecutionState, Result> ExecutionBlockImpl<Executor>::initializeCursor
static_assert(!std::is_same<Executor, IndexExecutor>::value || customInit,
"IndexExecutor is expected to implement a custom "
"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);

// // use this with c++17 instead of specialisation below
Expand Down
0