10000 Feature/aql subquery execution block impl execute implementation count collect by mchacki · Pull Request #11172 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/aql subquery execution block impl execute implementation count collect #11172

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
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
8b805d7
Move SubqueryStartExecutor to new interface
Jan 29, 2020
8ef2428
Diddle
Jan 31, 2020
2bda19d
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
Jan 31, 2020
147cd0c
Tests pass for SubqueryStartExecutor
Jan 31, 2020
cd694a1
Delete most of the SubqueryEndExecutor tests
Jan 31, 2020
7c5f90a
Skeleton tests
Feb 3, 2020
8f986f0
Junk
Feb 10, 2020
7332eff
Merge branch 'devel' into feature/AqlSubqueryExecutionBlockImplExecut…
Feb 10, 2020
fddf770
Cleanup and make work
Feb 11, 2020
6ddf0f1
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
Feb 11, 2020
1fe1772
Tweak ExecutorTestHelper to test pipelines
Feb 12, 2020
88ba3cd
SubqueryStart/SubqueryEnd
Feb 19, 2020
04de92e
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
Feb 19, 2020
1ae8cbc
Blafummel.
Feb 19, 2020
5881c54
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
Feb 20, 2020
041bd39
Modifications
Feb 20, 2020
de83c7b
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
Feb 20, 2020
187f38a
Fixup tests
Feb 20, 2020
7e33246
Addre 8000 ss some comments
Feb 20, 2020
1b47090
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
Feb 20, 2020
bf0b03d
Fix.
Feb 20, 2020
aeb3541
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
Feb 20, 2020
f2baeba
Fix tests
Feb 20, 2020
c5c20f8
Various fixes.
Feb 21, 2020
fc32f25
Made the branch compile on Mac
mchacki Feb 21, 2020
4bb25ce
Intermediate commit, does not compile, required for merge
mchacki Feb 21, 2020
dde4c58
Fixed one of the SplicedSubqueryTests
mchacki Feb 21, 2020
81443f6
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Feb 21, 2020
981b1ea
Seperated ShadowRow handling for SubqueryStart/End executors to get a…
mchacki Feb 21, 2020
a5099ef
Allow to use a fullCallStack in ExecutorTestHelper.
mchacki Feb 22, 2020
25e9c51
Added asserts on SubqueryEnd that is not allowed to be called with Sk…
mchacki Feb 22, 2020
24c8d27
Use AqlTestCase in SubqueryStartExecutorTest. Transformed first test …
mchacki Feb 22, 2020
fde3d31
Let ExecutorTestHelper also test for shadowRows
mchacki Feb 22, 2020
bc2ff3a
Adapted SingleInput=>Data+Shadow test to testing Helepr and make it pass
mchacki Feb 22, 2020
cf63e56
Transformed existing SubqueryStart tests to Helper, fixed a test wher…
mchacki Feb 22, 2020
238b905
Fixed Skip in SubqueryStartExecutor
mchacki Feb 23, 2020
6db38d2
Allow the Pipeline to add Consumer and dependency without fiddling wi…
mchacki Feb 23, 2020
8382a37
Added Skip adn ShadowRowForwarding tests to SubqueryStartExecutor
mchacki Feb 23, 2020
16c53a5
Fixed fullCount of SubqueryStart to be called properly.
mchacki Feb 23, 2020
2645708
Renamed isModificationSubquery -> isModificatioNode again
mchacki Feb 24, 2020
6c93d22
Consume more than one subquery en-block
mchacki Feb 24, 2020
5cb901b
Fixed debugReporting in SplicedSubqueryTest. Disabled the skip in sub…
mchacki Feb 24, 2020
c3b4551
Removed AQL debug log level from testing config
mchacki Feb 24, 2020
fca04a4
First version of Subquery Skip bypassing. Including 1 passing test.
mchacki Feb 24, 2020
da8ac78
Added disabled tests for skip, and proposed to do it later
mchacki Feb 24, 2020
43c7252
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Feb 24, 2020
c208d55
Fixed reporting of FILTERED in fullCount of EnumerateCollectionExecutor
mchacki Feb 24, 2020
eb5dc91
Enable calculationExecutor execute interface
mchacki Feb 24, 2020
595d7ee
Fixed compile issues
mchacki Feb 24, 2020
2a132d2
To Velocypack the modification Subquery value
mchacki Feb 24, 2020
c509270
Fixed illegal assert and reactivated failure tests
mchacki Feb 25, 2020
cfbf0d8
Fixed compile issue
mchacki Feb 25, 2020
6a3e41f
Deactivated Calculation again
mchacki Feb 25, 2020
1dacb92
Added a testSuite for countCollectExecutor
mchacki Feb 25, 2020
03b6193
Fixed Subquery Test for CountCollect
mchacki Feb 25, 2020
a7f1e56
Added CountCollectImplementation
mchacki Feb 25, 2020
4d7bc3b
Added Compatibility Mode to AqlCallStack
mchacki Feb 26, 2020
24e68a5
Removed IdExecutor<void> the only feature it has can be moved into ID…
mchacki Feb 26, 2020
1335302
When falling back in BlocksWithClients use compatibility stack
mchacki Feb 26, 2020
5db3328
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Feb 26, 2020
76a1797
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Feb 26, 2020
f3df055
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Feb 27, 2020
6c75a75
Fixed EnumerateCollectionExecutor
mchacki Feb 27, 2020
17f7169
Fixed fullCountBehaviour of EnumerateList. Also removed a unlimited,f…
mchacki Feb 27, 2020
f613876
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Feb 28, 2020
53ccaa8
Fixed endless loop while skipAl in OperationCursor
mchacki Feb 28, 2020
d8d19a5
Fixed View Executor, which sends a no-limit no-offset upstream.
mchacki Feb 28, 2020
572ac97
Fixed forwarding in NoResultsExecutor
mchacki Feb 28, 2020
1bb0a29
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Feb 29, 2020
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
Prev Previous commit
Next Next commit
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
…ion' of ssh://github.com/arangodb/ArangoDB into feature/AqlSubqueryExecutionBlockImplExecuteImplementation-subqueryStartExecutor
  • Loading branch information
mchacki committed Feb 21, 2020
commit 81443f6556ed1b9411e73a58f56ae9a9bc173815
11 changes: 8 additions & 3 deletions arangod/Aql/ExecutionBlockImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ constexpr bool isNewStyleExecutor =
TestLambdaExecutor,
TestLambdaSkipExecutor, // we need one after these to avoid compile errors in non-test mode
#endif
SubqueryStartExecutor, SubqueryEndExecutor, ShortestPathExecutor, EnumerateListExecutor>;
SubqueryStartExecutor, SubqueryEndExecutor, ShortestPathExecutor, EnumerateListExecutor, LimitExecutor>;

template <class Executor>
ExecutionBlockImpl<Executor>::ExecutionBlockImpl(ExecutionEngine* engine,
Expand Down Expand Up @@ -1086,7 +1086,8 @@ static SkipRowsRangeVariant constexpr skipRowsType() {
#ifdef ARANGODB_USE_GOOGLE_TESTS
TestLambdaSkipExecutor,
#endif
EnumerateListExecutor, SubqueryStartExecutor, SubqueryEndExecutor, SortedCollectExecutor>),
EnumerateListExecutor, SubqueryStartExecutor, SubqueryEndExecutor,
SortedCollectExecutor, LimitExecutor>),
"Unexpected executor for SkipVariants::EXECUTOR");

// The LimitExecutor will not work correctly with SkipVariants::FETCHER!
Expand Down Expand Up @@ -1146,13 +1147,15 @@ auto ExecutionBlockImpl<SubqueryStartExecutor>::shadowRowForwarding() -> ExecSta
TRI_ASSERT(_outputItemRow);
TRI_ASSERT(_outputItemRow->isInitialized());
TRI_ASSERT(_outputItemRow->allRowsUsed());
THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED);
}

template <>
auto ExecutionBlockImpl<SubqueryEndExecutor>::shadowRowForwarding() -> ExecState {
TRI_ASSERT(_outputItemRow);
TRI_ASSERT(_outputItemRow->isInitialized());
TRI_ASSERT(_outputItemRow->allRowsUsed());
THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED);
}

template <class Executor>
Expand Down Expand Up @@ -1485,6 +1488,9 @@ ExecutionBlockImpl<Executor>::executeWithoutTrace(AqlCallStack stack) {
TRI_ASSERT(!_lastRange.hasShadowRow());
size_t skippedLocal = 0;

#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
size_t subqueryLevelBefore = stack.subqueryLevel();
#endif
// If we are SubqueryStart, we remove the top element of the stack
// which belongs to the subquery enclosed by this
// SubqueryStart and the partnered SubqueryEnd by *not*
Expand Down Expand Up @@ -1512,7 +1518,6 @@ ExecutionBlockImpl<Executor>::executeWithoutTrace(AqlCallStack stack) {
}
}
}

std::tie(_upstreamState, skippedLocal, _lastRange) = _rowFetcher.execute(stack);
// As the stack is copied into the fetcher, we need to pop off our call again.
// If we use other datastructures or moving we may hand over ownership of the stack here
Expand Down
4 changes: 3 additions & 1 deletion arangod/Aql/ExecutionBlockImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ class ExecutionBlockImpl final : public ExecutionBlock {
// Executor is done, we need to handle ShadowRows of subqueries.
// In most executors they are simply copied, in subquery executors
// there needs to be actions applied here.
[[nodsicard]] auto shadowRowForwarding() -> ExecState;
[[nodiscard]] auto shadowRowForwarding() -> ExecState;

[[nodiscard]] auto outputIsFull() const noexcept -> bool;

private:
/**
Expand Down
64 changes: 48 additions & 16 deletions tests/Aql/ExecutorTestHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionBlockImpl.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionState.h"
#include "Aql/ExecutionStats.h"
#include "Aql/OutputAqlItemRow.h"
Expand Down Expand Up @@ -291,20 +292,32 @@ struct ExecutorTestHelper {
return *this;
}

/**
* @brief Set the Execution Block object
*
* @tparam E The executor
* @param infos to build the executor
* @param nodeType The type of executor node, only used for debug printing, defaults to SINGLETON
* @return ExecutorTestHelper&
*/
template <typename E>
auto setExecBlock(typename E::Infos infos) -> ExecutorTestHelper& {
auto setExecBlock(typename E::Infos infos,
ExecutionNode::NodeType nodeType = ExecutionNode::SINGLETON)
-> ExecutorTestHelper& {
auto& testeeNode = _execNodes.emplace_back(std::move(
std::make_unique<SingletonNode>(_query.plan(), _execNodes.size())));
std::make_unique<MockTypedNode>(_query.plan(), _execNodes.size(), nodeType)));
setPipeline(Pipeline{
std::make_unique<ExecutionBlockImpl<E>>(_query.engine(), testeeNode.get(),
std::move(infos))});
return *this;
}

template <typename E>
auto createExecBlock(typename E::Infos infos) -> ExecBlock {
auto createExecBlock(typename E::Infos infos,
ExecutionNode::NodeType nodeType = ExecutionNode::SINGLETON)
-> ExecBlock {
auto& testeeNode = _execNodes.emplace_back(std::move(
std::make_unique<SingletonNode>(_query.plan(), _execNodes.size())));
std::make_unique<MockTypedNode>(_query.plan(), _execNodes.size(), nodeType)));
return std::make_unique<ExecutionBlockImpl<E>>(_query.engine(), testeeNode.get(),
std::move(infos));
}
6D4E Expand Down Expand Up @@ -334,29 +347,48 @@ struct ExecutorTestHelper {
return *this;
}

auto run() -> void {
auto run(bool const loop = false) -> void {
ResourceMonitor monitor;
AqlItemBlockManager itemBlockManager(&monitor, SerializationFormat::SHADOWROWS);

auto inputBlock = generateInputRanges(itemBlockManager);

auto skippedTotal = size_t{0};
auto finalState = ExecutionState::HASMORE;

TRI_ASSERT(!_pipeline.empty());
_pipeline.get().back()->addDependency(inputBlock.get());

AqlCallStack stack{_call};
BlockCollector allResults{&itemBlockManager};

ExecutionState state;
size_t skipped;
SharedAqlItemBlockPtr result;
do {
std::tie(state, skipped, result) = _pipeline.get().front()->execute(stack);
if (!loop) {
AqlCallStack stack{_call};
auto const [state, skipped, result] = _pipeline.get().front()->execute(stack);
skippedTotal = skipped;
finalState = state;
if (result != nullptr) {
LOG_DEVEL << *result; // .slice().toJson();
allResults.add(result);
}
} while (state != ExecutionState::DONE);
} else {
auto call = _call;
do {
AqlCallStack stack{call};
auto const [state, skipped, result] = _pipeline.get().front()->execute(stack);
finalState = state;
skippedTotal += skipped;
if (result != nullptr) {
allResults.add(result);
}
call = _call;
call.didSkip(skippedTotal);
call.didProduce(allResults.totalSize());
} while (finalState != ExecutionState::DONE &&
(!call.hasSoftLimit() || (call.getLimit() + call.getOffset()) > 0));
}

EXPECT_EQ(skipped, _expectedSkip);
EXPECT_EQ(state, _expectedState);
EXPECT_EQ(skippedTotal, _expectedSkip);
EXPECT_EQ(finalState, _expectedState);
SharedAqlItemBlockPtr result = allResults.steal();
if (result == nullptr) {
// Empty output, possible if we skip all
EXPECT_EQ(_output.size(), 0)
Expand Down Expand Up @@ -459,7 +491,7 @@ struct ExecutorTestHelper {
arangodb::aql::Query& _query;
std::unique_ptr<arangodb::aql::ExecutionNode> _dummyNode;
Pipeline _pipeline;
std::vector<std::unique_ptr<ExecutionNode>> _execNodes;
std::vector<std::unique_ptr<MockTypedNode>> _execNodes;
};

enum class ExecutorCall {
Expand Down
12 changes: 6 additions & 6 deletions tests/Aql/ReturnExecutorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ TEST_P(ReturnExecutorTest, returns_all_from_upstream) {
ReturnExecutorInfos infos(0 /*input register*/, 1 /*nr in*/, 1 /*nr out*/, doCount());
AqlCall call{}; // unlimited produce
ExecutorTestHelper(*fakedQuery)
.setExecBlock<ReturnExecutor>(std::move(infos))
.setExecBlock<ReturnExecutor>(std::move(infos), ExecutionNode::RETURN)
.setInputValueList(1, 2, 5, 2, 1, 5, 7, 1)
.setInputSplitType(getSplit())
.setCall(call)
Expand All @@ -115,7 +115,7 @@ TEST_P(ReturnExecutorTest, handle_soft_limit) {
AqlCall call{};
call.softLimit = 3;
ExecutorTestHelper(*fakedQuery)
.setExecBlock<ReturnExecutor>(std::move(infos))
.setExecBlock<ReturnExecutor>(std::move(infos), ExecutionNode::RETURN)
.setInputValueList(1, 2, 5, 2, 1, 5, 7, 1)
.setInputSplitType(getSplit())
.setCall(call)
Expand All @@ -131,7 +131,7 @@ TEST_P(ReturnExecutorTest, handle_hard_limit) {
AqlCall call{};
call.hardLimit = 5;
ExecutorTestHelper(*fakedQuery)
.setExecBlock<ReturnExecutor>(std::move(infos))
.setExecBlock<ReturnExecutor>(std::move(infos), ExecutionNode::RETURN)
.setInputValueList(1, 2, 5, 2, 1, 5, 7, 1)
.setInputSplitType(getSplit())
.setCall(call)
Expand All @@ -147,7 +147,7 @@ TEST_P(ReturnExecutorTest, handle_offset) {
AqlCall call{};
call.offset = 4;
ExecutorTestHelper(*fakedQuery)
.setExecBlock<ReturnExecutor>(std::move(infos))
.setExecBlock<ReturnExecutor>(std::move(infos), ExecutionNode::RETURN)
.setInputValueList(1, 2, 5, 2, 1, 5, 7, 1)
.setInputSplitType(getSplit())
.setCall(call)
Expand All @@ -164,7 +164,7 @@ TEST_P(ReturnExecutorTest, handle_fullcount) {
call.hardLimit = 2;
call.fullCount = true;
ExecutorTestHelper(*fakedQuery)
.setExecBlock<ReturnExecutor>(std::move(infos))
.setExecBlock<ReturnExecutor>(std::move(infos), ExecutionNode::RETURN)
.setInputValueList(1, 2, 5, 2, 1, 5, 7, 1)
.setInputSplitType(getSplit())
.setCall(call)
Expand All @@ -180,7 +180,7 @@ TEST_P(ReturnExecutorTest, handle_other_inputRegister) {
AqlCall call{};
call.hardLimit = 5;
ExecutorTestHelper<2, 1>(*fakedQuery)
.setExecBlock<ReturnExecutor>(std::move(infos))
.setExecBlock<ReturnExecutor>(std::move(infos), ExecutionNode::RETURN)
.setInputValue({{R"("invalid")", 1},
{R"("invalid")", 2},
{R"("invalid")", 5},
Expand Down
9 changes: 3 additions & 6 deletions tests/Aql/SubqueryStartExecutorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ TEST_F(SubqueryStartExecutorTest, adds_a_shadowrow_after_single_input) {
auto state = ExecutorState::HASMORE;

auto inputBlock = buildBlock<1>(itemBlockManager, MatrixBuilder<1>{{{{R"("a")"}}}});
auto input =
AqlItemBlockInputRange{ExecutorState::DONE, inputBlock, 0, inputBlock->size()};
auto input = AqlItemBlockInputRange{ExecutorState::DONE, 0, inputBlock, 0};

OutputAqlItemRow output{std::move(block), infos.getOutputRegisters(),
infos.registersToKeep(), infos.registersToClear()};
Expand All @@ -141,8 +140,7 @@ TEST_F(SubqueryStartExecutorTest, adds_a_shadowrow_after_every_input_line_in_sin
auto inputBlock =
buildBlock<1>(itemBlockManager,
MatrixBuilder<1>{{{{{R"("a")"}}}, {{{R"("b")"}}}, {{R"("c")"}}}});
auto input =
AqlItemBlockInputRange{ExecutorState::DONE, inputBlock, 0, inputBlock->size()};
auto input = AqlItemBlockInputRange{ExecutorState::DONE, 0, inputBlock, 0};

SharedAqlItemBlockPtr block = itemBlockManager.requestBlock(1000, 1);
OutputAqlItemRow output{std::move(block), infos.getOutputRegisters(),
Expand All @@ -168,8 +166,7 @@ TEST_F(SubqueryStartExecutorTest, shadow_row_does_not_fit_in_current_block) {
auto inputBlock =
buildBlock<1>(itemBlockManager,
MatrixBuilder<1>{{{{{R"("a")"}}}, {{{R"("b")"}}}, {{R"("c")"}}}});
auto input =
AqlItemBlockInputRange{ExecutorState::DONE, inputBlock, 0, inputBlock->size()};
auto input = AqlItemBlockInputRange{ExecutorState::DONE, 0, inputBlock, 0};

SharedAqlItemBlockPtr block = itemBlockManager.requestBlock(3, 1);
OutputAqlItemRow output{std::move(block), infos.getOutputRegisters(),
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0