-
Notifications
You must be signed in to change notification settings - Fork 871
Feature/aql subquery execution block impl execute implementation batch sub queries #11318
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
mchacki
merged 213 commits into
devel
from
feature/AqlSubqueryExecutionBlockImplExecuteImplementation-batchSubQueries
Mar 25, 2020
Merged
Changes from all commits
Commits
Show all changes
213 commits
Select commit
Hold shift + click to select a range
35fe0e5
Added first draft of AqlCallObject
mchacki ead968c
Added AqlItemBlockInputRange
goedderz 7c6bcba
Added Header file for AqlCallStack with comments. No implementation yet.
mchacki 22d2977
Added AqlCallStack first draft implementation. Made everything compile
mchacki 3ab4488
Added empty dummy stubs for execute() in ExecutionBlock
mchacki b079d78
Implementation of new API in FilterExecutor. Rough implementation in …
mchacki eb120a0
Fixed off by one error in InputRange. Fixed FilterExecutor
mchacki cb2cef2
Added some more tests if executor cannot fulfill atMost
mchacki a46941e
Added heplper functions to the AqlCall struct to avoid mangeling arou…
mchacki e248e45
Add a member DataRange to ExecutionBlockImpl. Also now all Fetcher ex…
mchacki c40cfc0
Added preliminary minimal implementation of execute to DependencyProx…
mchacki dccbbcf
Merge branch 'devel' of github.com:arangodb/arangodb into feature/Aql…
hkernbach 2368252
added first implementation of count collect datarange produceRows fun…
hkernbach acb414f
Revert "added first implementation of count collect datarange produce…
hkernbach b66f314
Merge branch 'feature/AqlSubqueryOperationsStack' of ssh://github.com…
mchacki 5b0b8ce
Merge branch 'devel' into feature/AqlSubqueryOperationsStack
e0205b5
First draft of execute implementation, not yet handling ShadowRows th…
mchacki 3eff385
Merge branch 'feature/AqlSubqueryOperationsStack' of ssh://github.com…
mchacki 96c0fda
First working draft of execute() call in ExecutionBlockImpl. Tests ar…
mchacki 4d019a1
Removed non finished implementation from this Branch. It moved to sep…
mchacki aa275b4
working - not done yet
hkernbach fd33b7f
Revert "working - not done yet"
hkernbach 4d030f4
Intermediate devel pull, might not compile
mchacki 0300467
Finally merged with latest devel, seems to work
mchacki 907628e
Merge branch 'feature/AqlSubqueryOperationsStack' of ssh://github.com…
mchacki 11be23e
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki c703b11
first implementation of a ShadowRow fetching interface on AqlItemBloc…
mchacki 7911767
single row fetcher, execute + tests
hkernbach 45f7771
Merge
hkernbach b91be5f
Fixed SingleRowFetcherTest. Also an AqlItemBlockInputRange can now ha…
mchacki 8ba440c
Another fix on handling of shadow rows in InputRanges
mchacki b5dacbd
Improved human readable output of SortLimit test, while validating th…
mchacki a6281da
Removed debug profile execution of a query
mchacki 7a8a1dc
Use simpleVPack printing for Trace of Execute, better to read by humans
mchacki 40569e0
Merge branch 'feature/AqlSubqueryOperationsStack' of ssh://github.com…
mchacki d636a10
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki 2b13d48
Merge branch 'feature/AqlSubqueryOperationsStack' of ssh://github.com…
mchacki 8307d15
Added tests for AqlItemBlockInputRange and adjusted implementation ac…
mchacki c973149
Fixed issue where ExecutionBlockImpl returns DONE, although there are…
mchacki d83e3ac
Final modification of ShadowRows in FilterExecutor. All but profiling…
mchacki 9c8ae9d
Removed debug log includes
mchacki 990c487
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki e4dcdbc
Merge branch 'feature/AqlSubqueryOperationsStack' of ssh://github.com…
mchacki 292bd2a
Moved responsibility for the client call into the output row. This ca…
mchacki ba3eea6
Fixed FilterExecutorTest
mchacki d8f80f9
Expose required features to AqlCall controlled by the output aql item…
mchacki 6d18de7
Fixed bug with AqlCallStack pop operation that actually caused invali…
mchacki c84be59
outputRow now honors limits whan called for isFull.
mchacki 2eb29ad
Fixed isFull() in OutputAqlItemRow
mchacki 7151867
Use the inbound call in skipRows for executors, in order to do a more…
mchacki 26c1996
Make linker happy with operator< on CallLimit
mchacki dfd6d49
Implement operator+ on AqlCall::Limit, also use std::visit for readab…
mchacki 86db29c
FilterExecutor getSome now propagates offset + min(limits) to upstrea…
mchacki aa4323f
Fixed profiler tests for filter. These cannot be guaranteed anymore a…
mchacki 63f76e5
Fixed JSLint
mchacki df27560
Merge branch 'devel' into feature/AqlSubqueryExecutionBlockImplExecut…
7cddcfa
Remove special casing for FilterExecutor
73cf9af
Merge branch 'devel' into feature/AqlSubqueryExecutionBlockImplExecut…
63b0da1
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
247e668
Merge branch 'devel' of github.com:arangodb/arangodb into feature/Aql…
goedderz c9d1f2f
Merge branch 'feature/AqlSubqueryOperationsStack' of github.com:arang…
goedderz 9123516
Add skeleton skip code
b27d945
Replace C&P accident
7ad6c9e
Simplify and implement skip for new executor interface
64186d3
Fixup skipping for filter executor
266b8ad
Rename some methods for clarity and consistency
1628196
Introduce function to allocate an output block
7e8180f
Fix skipSome simulation bug
4e86d17
Some small cleanups
cfaf773
Merge branch 'devel' into feature/AqlSubqueryExecutionBlockImplExecut…
1ec2b8a
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki f5ef0e7
Replaced assertion on atMost on the output size. Otherwise we got int…
mchacki 862d316
Attempt at fixing execute
44d60bc
Merge branch 'devel' of github.com:arangodb/arangodb into feature/Aql…
goedderz 2f938c5
Merge branch 'feature/AqlSubqueryOperationsStack' into feature/AqlSub…
goedderz f3ec9c2
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki 397fee6
Merge branch 'devel' of github.com:arangodb/arangodb into feature/Aql…
goedderz a79a89e
Merge branch 'feature/AqlSubqueryOperationsStack' of github.com:arang…
goedderz 9ee9a0f
Merge branch 'devel' of github.com:arangodb/arangodb into feature/Aql…
goedderz 0624998
Merge branch 'feature/AqlSubqueryOperationsStack' into feature/AqlSub…
goedderz 12b1b2b
Merge branch 'devel' of github.com:arangodb/arangodb into feature/Aql…
goedderz 131c004
Merge branch 'feature/AqlSubqueryOperationsStack' of github.com:arang…
goedderz a656f39
Fix merge conflict
goedderz 508461e
Merge branch 'feature/AqlSubqueryOperationsStack' of github.com:arang…
goedderz 41c6d36
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki e03496a
Merge branch 'feature/AqlSubqueryOperationsStack' of ssh://github.com…
mchacki fdd0fed
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki 7ac26a3
Merge branch 'devel' into feature/AqlSubqueryOperationsStack
c9c54e3
Merge branch 'feature/AqlSubqueryOperationsStack' into feature/AqlSub…
beb7003
Feature/aql subquery execution block impl execute implementation exec…
mchacki ba5435b
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki 1d5e5a5
Merge branch 'feature/AqlSubqueryOperationsStack' of ssh://github.com…
mchacki 5b3e717
Feature/aql subquery execution block impl execute implementation shor…
mchacki 56d9cf0
Feature/aql subquery execution block impl execute implementation exec…
mchacki 7222d3e
Feature/aql subquery execution block impl execute implementation sort…
efd40c3
Merge branch 'devel' into feature/AqlSubqueryExecutionBlockImplExecut…
2b2625b
Merge branch 'devel' into feature/AqlSubqueryExecutionBlockImplExecut…
30d9f27
ReturnExecutor New style (#10831)
d4d3cd3
Merge branch 'devel' into feature/AqlSubqueryExecutionBlockImplExecut…
4028320
Merge branch 'devel' into feature/AqlSubqueryOperationsStack
3596c54
Merge branch 'devel' of github.com:arangodb/arangodb into feature/Aql…
goedderz a576003
Merge branch 'feature/AqlSubqueryOperationsStack' of github.com:arang…
goedderz 6359f0c
Tweak ExecutorTestHelper to test pipelines
c509e18
Revert "Tweak ExecutorTestHelper to test pipelines"
94da545
Added Stats return value to skipRowsRange (#11081)
mchacki 518c042
Additional Assertion in ExecutionBlockImpl (#11077)
mchacki 54043f3
Feature/aql subquery operations stack id executor (#10986)
mchacki 3963940
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki da03a1c
Merge branch 'feature/AqlSubqueryOperationsStack' of ssh://github.com…
mchacki 44fdb29
Replaced the operator== and operator!= with `isSameBlockAndIndex`. (#…
95a7326
New style IndexExecutor. (#11029)
10cc623
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki df13bbb
Merge branch 'feature/AqlSubqueryOperationsStack' of ssh://github.com…
mchacki 2157a75
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki dac0a10
Feature/aql subquery execution block impl execute implementation debu…
mchacki 1871aeb
Feature/aql subquery operations stack hashed collect executor (#11103)
mchacki 1a54762
Feature/aql subquery operations stack enumerate list (#10988)
hkernbach 6d6edc9
Feature/aql subquery execution block impl execute implementation inje…
mchacki 2077958
Tweak ExecutorTestHelper to test pipelines (#11079)
markuspf 2e2e214
AQL execute in LimitExecutor (#10886)
goedderz e7f36c3
Feature/aql subquery operations stack calculation exec enumerate exec…
hkernbach 557d5c5
Quickfix for compilation error due to merge
e6a31b7
Feature/aql subquery execution block impl execute implementation k sh…
markuspf b81dc94
Feature/aql subquery execution block impl execute implementation trav…
markuspf d8c41c2
Merge branch 'devel' of github.com:arangodb/arangodb into feature/Aql…
goedderz 4fa0860
Merge branch 'feature/AqlSubqueryOperationsStack' of github.com:arang…
goedderz 4dadc22
Move SubqueryStartExecutor to new interface (#11025)
markuspf 1cd9adb
Feature/aql subquery execute remote node api flag (#11159)
goedderz be42def
Feature/aql subquery operations stack i research view executor (#11140)
hkernbach abd2740
Move SingleRemoteModificationExecutor to new interface (#11166)
markuspf 39ecda2
Merge remote-tracking branch 'origin/devel' into feature/AqlSubqueryE…
9bf96cd
New style DistinctCollect (#11096)
c2ae621
Feature/aql subquery execution block impl execute implementation nore…
mchacki 4fe26a9
Moved Constrained sort to execute API (#11173)
mchacki a0d6ec1
Feature/aql subquery operations stack aql item block input matrix (#1…
hkernbach 28b9c04
Feature/aql subquery execute in restaqlhandler (#11175)
goedderz 08ceffe
Support executors with multiple dependencies (#11181)
markuspf 3ae0061
Move ModificationExecutors to new interface (#11165)
markuspf d4e7299
Feature/aql subquery operations stack materialize executor (#11192)
hkernbach 9a76c0c
Feature/aql subquery execute remote (#11197)
goedderz 98c7eb6
Added test for distinct collect with random order. (#11184)
609b0ff
Feature/aql subquery execution block impl execute implementation subq…
9bb106d
Feature/aql subquery execution block impl execute implementation coun…
mchacki 2262370
Activate CalculationExecutors (#11177)
mchacki c69dc93
Fixed compile bug-due to hidden merge conflict
mchacki 341ef5f
Feature/aql subquery execution block impl execute implementation base…
mchacki c653260
Fix memory leak in traversal (#11210)
markuspf 41ce860
AqlSubqueryExecutionBlockImplExecuteImplementation use moveValueInto …
markuspf 26242a1
Feature/aql subquery execution block impl execute implementation gath…
mchacki fd763cb
Feature/aql subquery execute parallel gather (#11215)
goedderz 4794ebe
Feature/aql subquery execute parallel gather 2 (#11221)
goedderz 25de4de
Feature/aql subquery execution block impl execute implementation bypa…
mchacki cb42580
Add some FilterExecutor and CalculationExecutor tests (#11231)
markuspf 10b24b2
Merge devel into feature/AqlSubqueryExecutionBlockImplExecuteImplemen…
mchacki 4b09567
Fixed assertion in SubqueryStart. On initial call it can be called wi…
mchacki ace0317
Added methods to count available rows in AqlItemBlockInputRange
mchacki b8d4b48
Allow a path to Ask the Executor how many rows are going to be produc…
mchacki 94d7729
Let Return and SubqueryExecutors present how many data rows are to be…
mchacki db8a775
Implement a fast forwarding of Rows in IdExecutor
mchacki 591d877
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki e431ccf
Initialize all the bools
mchacki 7c1069c
Fixed ASAN warning
mchacki bc40f02
Fixed ASAN warning in ShortestPathExecutor
mchacki c86f8fe
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki 350f6d0
Fixed invalid access in block allocation if input is empty
mchacki a102483
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki 014d1a4
Reactivated expectedNumberOfRows on all SingleRowFetcher executors
mchacki dafce76
Deactivated Debug Logging in Enumerate Collection Executor test
mchacki 920521b
Fixed SubqueryStartExecutor produceRows estimate
mchacki 33b9d94
For now SubqueryEndExecutor cannot define expected number of rows. We…
mchacki 9f618e4
SubqueryStart will have more output then limit defines (ShadowRow)
mchacki b00eff8
Fixed Filter numberOfExpectedRows
mchacki a6fd85c
Removed do-copy row test from ID executor. It now uses a fast-forward…
mchacki 31f0b2e
Only estimate the number of Rows if the range is complete.
mchacki a6003ea
On Collect nodes we sometimes produce an additional empty row
mchacki 9b853b3
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki 37f5e1f
Fixed endles loop in ParallelUnsortedGather, if the initial input is …
mchacki 1e68460
Removed isRelevant and all it's belong APIs from AqlCall. Has never b…
mchacki 0460fee
Added AqlCallList, this is supposed to be emplaced in the call-stack …
mchacki 8dc3be0
Prepared AqlCallStack to contain one (or even more but not used) look…
mchacki 85fe3c8
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki ac2b963
Allow batching of Subqueries. Temporarily disabled expectedNumberOfRo…
mchacki fec7dfd
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki 1c47be3
Reactivated expectedNumberOfRows, and fixed the estimate on SUbqueryS…
mchacki a40d7c4
Adapted SubqueryStartExecutorTest to new Execution methodology
mchacki a36d0ca
Fixed SubqueryStart handling of continuous subqueries
mchacki 49eab6d
Adapted AqlItemBlockRangeTest to check for HASMORE instead
mchacki e8e2503
Fixed singleRowFetcherTest to new state change in ShadowRows
mchacki a0d219a
Activated DISABLED tests, they actually work now.
mchacki bbc86cd
Fixed empty subquery situation when forwarding
mchacki 1f11032
Added a generic test framework for the Shared API of Fetchers
mchacki a9b91a5
Made AqlItemMatrix pass the InputRangeTests
mchacki a1d66dc
Fixed remaining GTests. Handling of consecutive Subqueries was not co…
mchacki 21fd2bc
Attempt to fix Modification executors in SubqueryByPassing variants
mchacki 7b63bb8
Removed wrong assertion
mchacki 53d634e
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki ece5b7a
Made MultiInputRange ready for RangeTest. Test is red still. Also avo…
mchacki dc0eb91
ShadowRows in MultiRange is the Maximum, not a Sum.
mchacki b2e165c
Initialize all the dependencies
mchacki a8638dd
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki c960f53
Add unused flag, because it is not used in one constexpr, but all the…
mchacki 0089e8f
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki 10a282d
Fixed compile issue
mchacki 3ed641c
Merge branch 'devel' of ssh://github.com/arangodb/ArangoDB into featu…
mchacki 998575a
Apply suggestions from code review
mchacki ec2b645
Added comments to AqlCallList and AqlCallStack to explain their diffe…
mchacki d9905c0
Memorized -> Memoized
mchacki 589a109
Explained the countShadowRows for MultiRanges
mchacki 620f108
Added clarification comment
mchacki b1622db
Do not try to write an if, that's impossible. Instead, only try to re…
mchacki 9a4610d
Added a comment why expectedNumbrOfRows is actually correct
mchacki 4ca7f54
Apply suggestions from code review
mchacki 0b6e1f1
Update arangod/Aql/ExecutionBlockImpl.cpp
mchacki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,264 @@ | ||
| //////////////////////////////////////////////////////////////////////////////// | ||
| /// DISCLAIMER | ||
| /// | ||
| /// Copyright 2019 ArangoDB GmbH, Cologne, Germany | ||
| /// | ||
| /// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| /// you may not use this file except in compliance with the License. | ||
| /// You may obtain a copy of the License at | ||
| /// | ||
| /// http://www.apache.org/licenses/LICENSE-2.0 | ||
| /// | ||
| /// Unless required by applicable law or agreed to in writing, software | ||
| /// distributed under the License is distributed on an "AS IS" BASIS, | ||
| /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| /// See the License for the specific language governing permissions and | ||
| /// limitations under the License. | ||
| /// | ||
| /// Copyright holder is ArangoDB GmbH, Cologne, Germany | ||
| /// | ||
| /// @author Michael Hackstein | ||
| //////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| #include "AqlCallList.h" | ||
|
|
||
| #include "Basics/StaticStrings.h" | ||
| #include "Basics/voc-errors.h" | ||
| #include "Containers/Enumerate.h" | ||
| #include "Logger/LogMacros.h" | ||
| #include "Logger/Logger.h" | ||
|
|
||
| #include <velocypack/Builder.h> | ||
| #include <velocypack/Collection.h> | ||
| #include <velocypack/Slice.h> | ||
| #include <velocypack/velocypack-aliases.h> | ||
|
|
||
| #include <iostream> | ||
| #include <map> | ||
| #include <string_view> | ||
|
|
||
| using namespace arangodb; | ||
| using namespace arangodb::aql; | ||
|
|
||
| namespace { | ||
| // hack for MSVC | ||
| auto getStringView(VPackSlice slice) -> std::string_view { | ||
| velocypack::StringRef ref = slice.stringRef(); | ||
| return std::string_view(ref.data(), ref.size()); | ||
| } | ||
| } // namespace | ||
|
|
||
| AqlCallList::AqlCallList(AqlCall const& call) : _specificCalls{call} {} | ||
|
|
||
| AqlCallList::AqlCallList(AqlCall const& specificCall, AqlCall const& defaultCall) | ||
| : _specificCalls{specificCall}, _defaultCall{defaultCall} {} | ||
|
|
||
| [[nodiscard]] auto AqlCallList::popNextCall() -> AqlCall { | ||
| TRI_ASSERT(hasMoreCalls()); | ||
| if (!_specificCalls.empty()) { | ||
| // We only implemented for a single given call. | ||
| TRI_ASSERT(_specificCalls.size() == 1); | ||
| auto res = _specificCalls.back(); | ||
| _specificCalls.pop_back(); | ||
| return res; | ||
| } | ||
| TRI_ASSERT(_defaultCall.has_value()); | ||
| return _defaultCall.value(); | ||
| } | ||
|
|
||
| [[nodiscard]] auto AqlCallList::peekNextCall() const -> AqlCall const& { | ||
| TRI_ASSERT(hasMoreCalls()); | ||
| if (!_specificCalls.empty()) { | ||
| // We only implemented for a single given call. | ||
| TRI_ASSERT(_specificCalls.size() == 1); | ||
| return _specificCalls.back(); | ||
| } | ||
| TRI_ASSERT(_defaultCall.has_value()); | ||
| return _defaultCall.value(); | ||
| } | ||
|
|
||
| [[nodiscard]] auto AqlCallList::hasMoreCalls() const noexcept -> bool { | ||
| return !_specificCalls.empty() || _defaultCall.has_value(); | ||
| } | ||
|
|
||
| [[nodiscard]] auto AqlCallList::modifyNextCall() -> AqlCall& { | ||
| TRI_ASSERT(hasMoreCalls()); | ||
| if (_specificCalls.empty()) { | ||
| TRI_ASSERT(_defaultCall.has_value()); | ||
| // We need to emplace a copy of defaultCall into the specific calls | ||
| // This can then be modified and eventually be consumed | ||
| _specificCalls.emplace_back(_defaultCall.value()); | ||
| } | ||
| return _specificCalls.back(); | ||
| } | ||
|
|
||
| auto AqlCallList::fromVelocyPack(VPackSlice slice) -> ResultT<AqlCallList> { | ||
mchacki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (ADB_UNLIKELY(!slice.isObject())) { | ||
| using namespace std::string_literals; | ||
| return Result(TRI_ERROR_TYPE_ERROR, | ||
| "When deserializating AqlCallList: Expected object, got "s + | ||
| slice.typeName()); | ||
| } | ||
|
|
||
| auto expectedPropertiesFound = std::map<std::string_view, bool>{}; | ||
| expectedPropertiesFound.emplace(StaticStrings::AqlCallListSpecific, false); | ||
| expectedPropertiesFound.emplace(StaticStrings::AqlCallListDefault, false); | ||
|
|
||
| auto const readSpecific = [](velocypack::Slice slice) -> ResultT<std::vector<AqlCall>> { | ||
| if (ADB_UNLIKELY(!slice.isArray())) { | ||
| auto message = std::string{"When deserializating AqlCall: When reading " + | ||
| StaticStrings::AqlCallListSpecific + | ||
| ": " | ||
| "Unexpected type "}; | ||
| message += slice.typeName(); | ||
| return Result(TRI_ERROR_TYPE_ERROR, std::move(message)); | ||
| } | ||
| std::vector<AqlCall> res; | ||
| res.reserve(slice.length()); | ||
| for (auto const& c : VPackArrayIterator(slice)) { | ||
| auto maybeAqlCall = AqlCall::fromVelocyPack(c); | ||
| if (ADB_UNLIKELY(maybeAqlCall.fail())) { | ||
| auto message = std::string{"When deserializing AqlCallList: entry "}; | ||
| message += std::to_string(res.size()); | ||
| message += ": "; | ||
| message += std::move(maybeAqlCall).errorMessage(); | ||
| return Result(TRI_ERROR_TYPE_ERROR, std::move(message)); | ||
| } | ||
| res.emplace_back(maybeAqlCall.get()); | ||
| } | ||
| return res; | ||
| }; | ||
|
|
||
| auto const readDefault = [](velocypack::Slice slice) -> ResultT<std::optional<AqlCall>> { | ||
| if (ADB_UNLIKELY(!slice.isObject() && !slice.isNull())) { | ||
| auto message = | ||
| std::string{"When deserializating AqlCallList: When reading " + | ||
| StaticStrings::AqlCallListDefault + | ||
| ": " | ||
| "Unexpected type "}; | ||
| message += slice.typeName(); | ||
| return Result(TRI_ERROR_TYPE_ERROR, std::move(message)); | ||
| } | ||
| if (slice.isNull()) { | ||
| return {std::nullopt}; | ||
| } | ||
| auto maybeAqlCall = AqlCall::fromVelocyPack(slice); | ||
| if (ADB_UNLIKELY(maybeAqlCall.fail())) { | ||
| auto message = std::string{"When deserializing AqlCallList: default "}; | ||
| message += std::move(maybeAqlCall).errorMessage(); | ||
| return Result(TRI_ERROR_TYPE_ERROR, std::move(message)); | ||
| } | ||
| return {std::move(maybeAqlCall.get())}; | ||
| }; | ||
|
|
||
| AqlCallList result{AqlCall{}}; | ||
|
|
||
| for (auto const it : velocypack::ObjectIterator(slice)) { | ||
| auto const keySlice = it.key; | ||
| if (ADB_UNLIKELY(!keySlice.isString())) { | ||
| return Result(TRI_ERROR_TYPE_ERROR, | ||
| "When deserializating AqlCallList: Key is not a string"); | ||
| } | ||
| auto const key = getStringView(keySlice); | ||
|
|
||
| if (auto propIt = expectedPropertiesFound.find(key); | ||
| ADB_LIKELY(propIt != expectedPropertiesFound.end())) { | ||
| if (ADB_UNLIKELY(propIt->second)) { | ||
| return Result( | ||
| TRI_ERROR_TYPE_ERROR, | ||
| "When deserializating AqlCallList: Encountered duplicate key"); | ||
| } | ||
| propIt->second = true; | ||
| } | ||
|
|
||
| if (key == StaticStrings::AqlCallListSpecific) { | ||
| auto maybeCalls = readSpecific(it.value); | ||
| if (maybeCalls.fail()) { | ||
| return std::move(maybeCalls).result(); | ||
| } | ||
| result._specificCalls = maybeCalls.get(); | ||
| } else if (key == StaticStrings::AqlCallListDefault) { | ||
| auto maybeCall = readDefault(it.value); | ||
| if (maybeCall.fail()) { | ||
| return std::move(maybeCall).result(); | ||
| } | ||
| result._defaultCall = maybeCall.get(); | ||
| } else { | ||
| LOG_TOPIC("c30c1", WARN, Logger::AQL) | ||
| << "When deserializating AqlCallList: Encountered unexpected key " << key; | ||
| // If you run into this assertion during rolling upgrades after adding a | ||
| // new attribute, remove it in the older version. | ||
| TRI_ASSERT(false); | ||
| } | ||
| } | ||
|
|
||
| for (auto const& it : expectedPropertiesFound) { | ||
| if (ADB_UNLIKELY(!it.second)) { | ||
| auto message = std::string{"When deserializating AqlCall: missing key "}; | ||
| message += it.first; | ||
| return Result(TRI_ERROR_TYPE_ERROR, std::move(message)); | ||
| } | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| auto AqlCallList::toVelocyPack(VPackBuilder& builder) const -> void { | ||
| // We need to have something that is serializable | ||
| TRI_ASSERT(hasMoreCalls()); | ||
| builder.openObject(); | ||
| builder.add(VPackValue(StaticStrings::AqlCallListSpecific)); | ||
|
|
||
| { | ||
| builder.openArray(); | ||
| for (auto const& call : _specificCalls) { | ||
| call.toVelocyPack(builder); | ||
| } | ||
| builder.close(); | ||
| } | ||
| builder.add(VPackValue(StaticStrings::AqlCallListDefault)); | ||
| if (_defaultCall.has_value()) { | ||
| _defaultCall.value().toVelocyPack(builder); | ||
| } else { | ||
| builder.add(VPackSlice::nullSlice()); | ||
| } | ||
|
|
||
| builder.close(); | ||
| } | ||
|
|
||
| auto AqlCallList::toString() const -> std::string { | ||
| auto stream = std::stringstream{}; | ||
| stream << *this; | ||
| return stream.str(); | ||
| } | ||
|
|
||
| bool arangodb::aql::operator==(AqlCallList const& left, AqlCallList const& right) { | ||
| if (left._specificCalls.size() != right._specificCalls.size()) { | ||
| return false; | ||
| } | ||
| // Sorry call does not implement operator!= | ||
| if (!(left._defaultCall == right._defaultCall)) { | ||
| return false; | ||
| } | ||
| for (auto const& [index, call] : enumerate(left._specificCalls)) { | ||
| if (!(call == right._specificCalls[index])) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| auto arangodb::aql::operator<<(std::ostream& out, AqlCallList const& list) -> std::ostream& { | ||
| out << "specific: [ "; | ||
| for (auto const& [index, call] : enumerate(list._specificCalls)) { | ||
| if (index > 0) { | ||
| out << ", "; | ||
| } | ||
| out << call; | ||
| } | ||
| out << " ]"; | ||
| if (list._defaultCall.has_value()) { | ||
| out << " default: " << list._defaultCall.value(); | ||
| } | ||
| return out; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.