diff --git a/CMakeLists.txt b/CMakeLists.txt index b46d26da9904..92ab08248139 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1253,7 +1253,6 @@ link_libraries( absl::flat_hash_map absl::node_hash_set absl::node_hash_map - absl::inlined_vector absl::synchronization ) diff --git a/arangod/Aql/AqlItemBlock.cpp b/arangod/Aql/AqlItemBlock.cpp index a2a88ee142d5..facea02a728b 100644 --- a/arangod/Aql/AqlItemBlock.cpp +++ b/arangod/Aql/AqlItemBlock.cpp @@ -561,9 +561,7 @@ SharedAqlItemBlockPtr AqlItemBlock::slice(size_t from, size_t to) const { TRI_ASSERT(from < to); TRI_ASSERT(to <= _numRows); - arangodb::containers::SmallVector< - std::pair>::allocator_type::arena_type arena; - arangodb::containers::SmallVector> ranges{arena}; + containers::SmallVector, 4> ranges; ranges.emplace_back(from, to); return slice(ranges); } @@ -580,8 +578,7 @@ SharedAqlItemBlockPtr AqlItemBlock::slice(size_t from, size_t to) const { * @return SharedAqlItemBlockPtr A block where all the slices are contained in * the order of the list */ -auto AqlItemBlock::slice( - arangodb::containers::SmallVector> const& ranges) +auto AqlItemBlock::slice(std::span const> ranges) const -> SharedAqlItemBlockPtr { #ifdef ARANGODB_ENABLE_MAINTAINER_MODE // Analyze correctness of ranges diff --git a/arangod/Aql/AqlItemBlock.h b/arangod/Aql/AqlItemBlock.h index ce27f07a604d..404ec07c267f 100644 --- a/arangod/Aql/AqlItemBlock.h +++ b/arangod/Aql/AqlItemBlock.h @@ -26,9 +26,11 @@ #include "Aql/AqlValue.h" #include "Basics/ResourceUsage.h" #include "Containers/FlatHashMap.h" + #include "Containers/SmallVector.h" #include +#include #include #include #include @@ -255,8 +257,8 @@ class AqlItemBlock { * @return SharedAqlItemBlockPtr A block where all the slices are contained in * the order of the list */ - auto slice(arangodb::containers::SmallVector> const& - ranges) const -> SharedAqlItemBlockPtr; + auto slice(std::span const> ranges) const + -> SharedAqlItemBlockPtr; /// @brief create an AqlItemBlock with a single row, with copies of the /// specified registers from the current block diff --git a/arangod/Aql/Ast.cpp b/arangod/Aql/Ast.cpp index 6514344474ee..1111ce87e543 100644 --- a/arangod/Aql/Ast.cpp +++ b/arangod/Aql/Ast.cpp @@ -3005,7 +3005,7 @@ AstNode* Ast::makeConditionFromExample(AstNode const* node) { } AstNode* result = nullptr; - ::arangodb::containers::SmallVectorWithArena attributeParts; + containers::SmallVector attributeParts; std::function createCondition = [&](AstNode const* object) -> void { @@ -3914,7 +3914,7 @@ AstNode const* Ast::resolveConstAttributeAccess(AstNode const* node, TRI_ASSERT(node->type == NODE_TYPE_ATTRIBUTE_ACCESS); AstNode const* original = node; - ::arangodb::containers::SmallVectorWithArena attributeNames; + containers::SmallVector attributeNames; while (node->type == NODE_TYPE_ATTRIBUTE_ACCESS) { attributeNames.push_back(node->getStringView()); diff --git a/arangod/Aql/CalculationNodeVarFinder.cpp b/arangod/Aql/CalculationNodeVarFinder.cpp index d8c0d18506f1..e90600e9f00e 100644 --- a/arangod/Aql/CalculationNodeVarFinder.cpp +++ b/arangod/Aql/CalculationNodeVarFinder.cpp @@ -28,7 +28,7 @@ namespace aql { CalculationNodeVarFinder::CalculationNodeVarFinder( Variable const* lookingFor, - ::arangodb::containers::SmallVector& out) noexcept + containers::SmallVector& out) noexcept : _lookingFor(lookingFor), _out(out) {} bool CalculationNodeVarFinder::before(ExecutionNode* en) { diff --git a/arangod/Aql/CalculationNodeVarFinder.h b/arangod/Aql/CalculationNodeVarFinder.h index a3a367e5fb78..acae8751680f 100644 --- a/arangod/Aql/CalculationNodeVarFinder.h +++ b/arangod/Aql/CalculationNodeVarFinder.h @@ -34,14 +34,14 @@ class CalculationNodeVarFinder final : public WalkerWorker { Variable const* _lookingFor; - ::arangodb::containers::SmallVector& _out; + containers::SmallVector& _out; VarSet _currentUsedVars; public: CalculationNodeVarFinder( Variable const* var, - ::arangodb::containers::SmallVector& out) noexcept; + containers::SmallVector& out) noexcept; bool before(ExecutionNode*) override final; }; diff --git a/arangod/Aql/ConstFetcher.cpp b/arangod/Aql/ConstFetcher.cpp index 8f0528fc610e..5e12c4e1ce19 100644 --- a/arangod/Aql/ConstFetcher.cpp +++ b/arangod/Aql/ConstFetcher.cpp @@ -29,7 +29,6 @@ #include "Aql/SkipResult.h" #include "Basics/Exceptions.h" #include "Basics/voc-errors.h" -#include "Containers/SmallVector.h" #include @@ -55,10 +54,7 @@ auto ConstFetcher::execute(AqlCallStack& stack) AqlItemBlockInputRange{MainQueryState::DONE}}; } - arangodb::containers::SmallVector< - std::pair>::allocator_type::arena_type arena; - arangodb::containers::SmallVector> sliceIndexes{ - arena}; + containers::SmallVector, 4> sliceIndexes; sliceIndexes.emplace_back(_rowIndex, _blockForPassThrough->numRows()); @@ -238,8 +234,7 @@ auto ConstFetcher::numRowsLeft() const noexcept -> size_t { } auto ConstFetcher::canUseFullBlock( - arangodb::containers::SmallVector> const& ranges) - const noexcept -> bool { + std::span const> ranges) const noexcept -> bool { TRI_ASSERT(!ranges.empty()); if (ranges.front().first != 0) { // We do not start at the first index. diff --git a/arangod/Aql/ConstFetcher.h b/arangod/Aql/ConstFetcher.h index 2300d98a845e..0297753b4f9d 100644 --- a/arangod/Aql/ConstFetcher.h +++ b/arangod/Aql/ConstFetcher.h @@ -27,9 +27,9 @@ #include "Aql/ExecutionState.h" #include "Aql/InputAqlItemRow.h" #include "Aql/SkipResult.h" -#include "Containers/SmallVector.h" #include +#include namespace arangodb { namespace aql { @@ -106,8 +106,7 @@ class ConstFetcher { auto indexIsValid() const noexcept -> bool; auto numRowsLeft() const noexcept -> size_t; auto canUseFullBlock( - arangodb::containers::SmallVector> const& - ranges) const noexcept -> bool; + std::span const> ranges) const noexcept -> bool; }; } // namespace aql diff --git a/arangod/Aql/ExecutionNode.cpp b/arangod/Aql/ExecutionNode.cpp index ca96831db40a..59930b637334 100644 --- a/arangod/Aql/ExecutionNode.cpp +++ b/arangod/Aql/ExecutionNode.cpp @@ -718,11 +718,7 @@ bool ExecutionNode::doWalk(WalkerWorkerBase& worker, // we can be quite generous with the buffer size since the implementation is // not recursive. constexpr std::size_t NumBufferedEntries = 1000; - constexpr std::size_t BufferSize = sizeof(Entry) * NumBufferedEntries; - containers::SmallVectorWithArena nodes; - // Our stackbased arena can hold NumBufferedEntries, so we reserve everythhing - // at once. - nodes.reserve(NumBufferedEntries); + containers::SmallVector nodes; nodes.emplace_back(const_cast(this), State::Pending); auto enqueDependencies = [&nodes](std::vector& deps) { @@ -2205,11 +2201,11 @@ bool SubqueryNode::mayAccessCollections() { ExecutionNode::SHORTEST_PATH, ExecutionNode::K_SHORTEST_PATHS}; - ::arangodb::containers::SmallVectorWithArena nodes; + containers::SmallVector nodes; NodeFinder, WalkerUniqueness::Unique> - finder(types, nodes.vector(), true); + finder(types, nodes, true); _subquery->walk(finder); if (!nodes.empty()) { diff --git a/arangod/Aql/ExecutionPlan.cpp b/arangod/Aql/ExecutionPlan.cpp index 9ef280d37980..d35c875947dc 100644 --- a/arangod/Aql/ExecutionPlan.cpp +++ b/arangod/Aql/ExecutionPlan.cpp @@ -2336,7 +2336,7 @@ ExecutionNode* ExecutionPlan::fromNode(AstNode const* node) { template /// @brief find nodes of certain types void ExecutionPlan::findNodesOfType( - ::arangodb::containers::SmallVector& result, + containers::SmallVector& result, std::initializer_list const& types, bool enterSubqueries) { // check if any of the node types is actually present in the plan @@ -2353,14 +2353,14 @@ void ExecutionPlan::findNodesOfType( /// @brief find nodes of a certain type void ExecutionPlan::findNodesOfType( - ::arangodb::containers::SmallVector& result, + containers::SmallVector& result, ExecutionNode::NodeType type, bool enterSubqueries) { findNodesOfType(result, {type}, enterSubqueries); } /// @brief find nodes of certain types void ExecutionPlan::findNodesOfType( - ::arangodb::containers::SmallVector& result, + containers::SmallVector& result, std::initializer_list const& types, bool enterSubqueries) { findNodesOfType(result, types, enterSubqueries); @@ -2368,7 +2368,7 @@ void ExecutionPlan::findNodesOfType( /// @brief find nodes of certain types void ExecutionPlan::findUniqueNodesOfType( - ::arangodb::containers::SmallVector& result, + containers::SmallVector& result, std::initializer_list const& types, bool enterSubqueries) { findNodesOfType(result, types, enterSubqueries); @@ -2376,7 +2376,7 @@ void ExecutionPlan::findUniqueNodesOfType( /// @brief find all end nodes in a plan void ExecutionPlan::findEndNodes( - ::arangodb::containers::SmallVector& result, + containers::SmallVector& result, bool enterSubqueries) const { EndNodeFinder finder(result, enterSubqueries); root()->walk(finder); @@ -2678,9 +2678,7 @@ void ExecutionPlan::findCollectionAccessVariables() { } void ExecutionPlan::prepareTraversalOptions() { - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + containers::SmallVector nodes; findNodesOfType(nodes, {arangodb::aql::ExecutionNode::TRAVERSAL, arangodb::aql::ExecutionNode::SHORTEST_PATH, diff --git a/arangod/Aql/ExecutionPlan.h b/arangod/Aql/ExecutionPlan.h index 27b5cd2274d2..3dfe7613267c 100644 --- a/arangod/Aql/ExecutionPlan.h +++ b/arangod/Aql/ExecutionPlan.h @@ -196,24 +196,22 @@ class ExecutionPlan { } /// @brief find nodes of a certain type - void findNodesOfType( - ::arangodb::containers::SmallVector& result, - ExecutionNode::NodeType, bool enterSubqueries); + void findNodesOfType(containers::SmallVector& result, + ExecutionNode::NodeType, bool enterSubqueries); /// @brief find nodes of certain types - void findNodesOfType( - ::arangodb::containers::SmallVector& result, - std::initializer_list const&, - bool enterSubqueries); + void findNodesOfType(containers::SmallVector& result, + std::initializer_list const&, + bool enterSubqueries); /// @brief find unique nodes of certain types void findUniqueNodesOfType( - ::arangodb::containers::SmallVector& result, + containers::SmallVector& result, std::initializer_list const&, bool enterSubqueries); /// @brief find all end nodes in a plan - void findEndNodes(::arangodb::containers::SmallVector& result, + void findEndNodes(containers::SmallVector& result, bool enterSubqueries) const; /// @brief determine and set _varsUsedLater and _varSetBy @@ -319,10 +317,9 @@ class ExecutionPlan { private: template /// @brief find nodes of certain types - void findNodesOfType( - ::arangodb::containers::SmallVector& result, - std::initializer_list const&, - bool enterSubqueries); + void findNodesOfType(containers::SmallVector& result, + std::initializer_list const&, + bool enterSubqueries); /// @brief creates a calculation node ExecutionNode* createCalculation(Variable*, AstNode const*, ExecutionNode*); diff --git a/arangod/Aql/Expression.cpp b/arangod/Aql/Expression.cpp index efc6dca733d2..64eade436c6e 100644 --- a/arangod/Aql/Expression.cpp +++ b/arangod/Aql/Expression.cpp @@ -825,10 +825,10 @@ AqlValue Expression::executeSimpleExpressionFCallCxx(ExpressionContext& ctx, // use stack-based allocation for the first few function call // parameters. this saves a few heap allocations per function // call invocation - ::arangodb::containers::SmallVectorWithArena parameters; + containers::SmallVector parameters; // same here - ::arangodb::containers::SmallVectorWithArena destroyParameters; + containers::SmallVector destroyParameters; explicit FunctionParameters(size_t n) { parameters.reserve(n); @@ -866,7 +866,7 @@ AqlValue Expression::executeSimpleExpressionFCallCxx(ExpressionContext& ctx, TRI_ASSERT(params.parameters.size() == params.destroyParameters.size()); TRI_ASSERT(params.parameters.size() == n); - AqlValue a = func->implementation(&ctx, *node, params.parameters.vector()); + AqlValue a = func->implementation(&ctx, *node, params.parameters); mustDestroy = true; // function result is always dynamic return a; diff --git a/arangod/Aql/Functions.cpp b/arangod/Aql/Functions.cpp index 490d6e5e337d..0f1d42555831 100644 --- a/arangod/Aql/Functions.cpp +++ b/arangod/Aql/Functions.cpp @@ -249,7 +249,7 @@ void registerICUWarning(ExpressionContext* expressionContext, /// @brief extract a function parameter from the arguments inline AqlValue const& extractFunctionParameterValue( - VPackFunctionParameters const& parameters, size_t position) { + VPackFunctionParametersView parameters, size_t position) { if (position >= parameters.size()) { // parameter out of range return ::emptyAqlValue; @@ -530,7 +530,7 @@ AqlValue addOrSubtractIsoDurationFromTimestamp( } bool parameterToTimePoint(ExpressionContext* expressionContext, - VPackFunctionParameters const& parameters, + VPackFunctionParametersView parameters, tp_sys_clock_ms& tp, char const* AFN, size_t parameterIndex) { AqlValue const& value = @@ -630,7 +630,7 @@ double valueToNumber(VPackSlice const& slice, bool& isValid) { } /// @brief extract a boolean parameter from an array -bool getBooleanParameter(VPackFunctionParameters const& parameters, +bool getBooleanParameter(VPackFunctionParametersView parameters, size_t startParameter, bool defaultValue) { size_t const n = parameters.size(); @@ -643,7 +643,7 @@ bool getBooleanParameter(VPackFunctionParameters const& parameters, /// @brief extra a collection name from an AqlValue std::string extractCollectionName(transaction::Methods* trx, - VPackFunctionParameters const& parameters, + VPackFunctionParametersView parameters, size_t position) { AqlValue const& value = extractFunctionParameterValue(parameters, position); @@ -685,8 +685,8 @@ std::string extractCollectionName(transaction::Methods* trx, void extractKeys(containers::FlatHashSet& names, ExpressionContext* expressionContext, VPackOptions const* vopts, - VPackFunctionParameters const& parameters, - size_t startParameter, char const* functionName) { + VPackFunctionParametersView parameters, size_t startParameter, + char const* functionName) { size_t const n = parameters.size(); for (size_t i = startParameter; i < n; ++i) { @@ -920,7 +920,7 @@ void getDocumentByIdentifier(transaction::Methods* trx, /// Works for an array of objects as first parameter or arbitrary many /// object parameters AqlValue mergeParameters(ExpressionContext* expressionContext, - VPackFunctionParameters const& parameters, + VPackFunctionParametersView parameters, char const* funcName, bool recursive) { size_t const n = parameters.size(); @@ -1011,7 +1011,7 @@ void flattenList(VPackSlice const& array, size_t maxDepth, size_t curDepth, * @return Returns a timestamp if asTimestamp is true, an ISO_DATE otherwise */ AqlValue dateFromParameters(ExpressionContext* expressionContext, - VPackFunctionParameters const& parameters, + VPackFunctionParametersView parameters, char const* AFN, bool asTimestamp) { tp_sys_clock_ms tp; duration time; @@ -1097,7 +1097,7 @@ AqlValue dateFromParameters(ExpressionContext* expressionContext, AqlValue callApplyBackend(ExpressionContext* expressionContext, AstNode const& node, char const* AFN, AqlValue const& invokeFN, - VPackFunctionParameters const& invokeParams) { + VPackFunctionParametersView invokeParams) { auto& trx = expressionContext->trx(); std::string ucInvokeFN; @@ -1185,7 +1185,7 @@ AqlValue callApplyBackend(ExpressionContext* expressionContext, AqlValue geoContainsIntersect(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters, + VPackFunctionParametersView parameters, char const* func, bool contains) { auto* vopts = &expressionContext->trx().vpackOptions(); AqlValue const& p1 = extractFunctionParameterValue(parameters, 0); @@ -1437,49 +1437,49 @@ void Functions::Stringify(VPackOptions const* vopts, /// @brief function IS_NULL AqlValue Functions::IsNull(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& a = extractFunctionParameterValue(parameters, 0); return AqlValue(AqlValueHintBool(a.isNull(true))); } /// @brief function IS_BOOL AqlValue Functions::IsBool(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& a = extractFunctionParameterValue(parameters, 0); return AqlValue(AqlValueHintBool(a.isBoolean())); } /// @brief function IS_NUMBER AqlValue Functions::IsNumber(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& a = extractFunctionParameterValue(parameters, 0); return AqlValue(AqlValueHintBool(a.isNumber())); } /// @brief function IS_STRING AqlValue Functions::IsString(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& a = extractFunctionParameterValue(parameters, 0); return AqlValue(AqlValueHintBool(a.isString())); } /// @brief function IS_ARRAY AqlValue Functions::IsArray(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& a = extractFunctionParameterValue(parameters, 0); return AqlValue(AqlValueHintBool(a.isArray())); } /// @brief function IS_OBJECT AqlValue Functions::IsObject(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& a = extractFunctionParameterValue(parameters, 0); return AqlValue(AqlValueHintBool(a.isObject())); } /// @brief function TYPENAME AqlValue Functions::Typename(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); char const* type = value.getTypeString(); @@ -1488,7 +1488,7 @@ AqlValue Functions::Typename(ExpressionContext*, AstNode const&, /// @brief function TO_NUMBER AqlValue Functions::ToNumber(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& a = extractFunctionParameterValue(parameters, 0); bool failed; double value = a.toDouble(failed); @@ -1502,7 +1502,7 @@ AqlValue Functions::ToNumber(ExpressionContext*, AstNode const&, /// @brief function TO_STRING AqlValue Functions::ToString(ExpressionContext* expr, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto& trx = expr->trx(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -1515,7 +1515,7 @@ AqlValue Functions::ToString(ExpressionContext* expr, AstNode const&, /// @brief function TO_BASE64 AqlValue Functions::ToBase64(ExpressionContext* expr, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto& trx = expr->trx(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -1532,7 +1532,7 @@ AqlValue Functions::ToBase64(ExpressionContext* expr, AstNode const&, /// @brief function TO_HEX AqlValue Functions::ToHex(ExpressionContext* expr, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto& trx = expr->trx(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -1548,9 +1548,8 @@ AqlValue Functions::ToHex(ExpressionContext* expr, AstNode const&, } /// @brief function ENCODE_URI_COMPONENT -AqlValue Functions::EncodeURIComponent( - ExpressionContext* expr, AstNode const&, - VPackFunctionParameters const& parameters) { +AqlValue Functions::EncodeURIComponent(ExpressionContext* expr, AstNode const&, + VPackFunctionParametersView parameters) { auto& trx = expr->trx(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -1567,7 +1566,7 @@ AqlValue Functions::EncodeURIComponent( /// @brief function UUID AqlValue Functions::Uuid(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { boost::uuids::uuid uuid; { // must protect mutex generation from races @@ -1580,7 +1579,7 @@ AqlValue Functions::Uuid(ExpressionContext*, AstNode const&, /// @brief function SOUNDEX AqlValue Functions::Soundex(ExpressionContext* expr, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto& trx = expr->trx(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -1599,7 +1598,7 @@ AqlValue Functions::Soundex(ExpressionContext* expr, AstNode const&, /// @brief function LEVENSHTEIN_DISTANCE AqlValue Functions::LevenshteinDistance( ExpressionContext* expr, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto& trx = expr->trx(); AqlValue const& value1 = extractFunctionParameterValue(parameters, 0); AqlValue const& value2 = extractFunctionParameterValue(parameters, 1); @@ -1626,7 +1625,7 @@ AqlValue Functions::LevenshteinDistance( namespace { template AqlValue NgramSimilarityHelper(char const* AFN, ExpressionContext* ctx, - VPackFunctionParameters const& args) { + VPackFunctionParametersView args) { TRI_ASSERT(ctx); if (args.size() < 3) { registerWarning( @@ -1680,22 +1679,21 @@ AqlValue NgramSimilarityHelper(char const* AFN, ExpressionContext* ctx, /// Executes NGRAM_SIMILARITY based on binary ngram similarity AqlValue Functions::NgramSimilarity(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& args) { + VPackFunctionParametersView args) { static char const* AFN = "NGRAM_SIMILARITY"; return NgramSimilarityHelper(AFN, ctx, args); } /// Executes NGRAM_POSITIONAL_SIMILARITY based on positional ngram similarity AqlValue Functions::NgramPositionalSimilarity( - ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& args) { + ExpressionContext* ctx, AstNode const&, VPackFunctionParametersView args) { static char const* AFN = "NGRAM_POSITIONAL_SIMILARITY"; return NgramSimilarityHelper(AFN, ctx, args); } /// Executes NGRAM_MATCH based on binary ngram similarity AqlValue Functions::NgramMatch(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& args) { + VPackFunctionParametersView args) { TRI_ASSERT(ctx); static char const* AFN = "NGRAM_MATCH"; @@ -1818,7 +1816,7 @@ AqlValue Functions::NgramMatch(ExpressionContext* ctx, AstNode const&, /// Executes LEVENSHTEIN_MATCH AqlValue Functions::LevenshteinMatch(ExpressionContext* ctx, AstNode const& node, - VPackFunctionParameters const& args) { + VPackFunctionParametersView args) { static char const* AFN = "LEVENSHTEIN_MATCH"; auto const& maxDistance = extractFunctionParameterValue(args, 2); @@ -1884,7 +1882,7 @@ AqlValue Functions::LevenshteinMatch(ExpressionContext* ctx, /// @brief function IN_RANGE AqlValue Functions::InRange(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& args) { + VPackFunctionParametersView args) { static char const* AFN = "IN_RANGE"; auto const argc = args.size(); @@ -1936,14 +1934,14 @@ AqlValue Functions::InRange(ExpressionContext* ctx, AstNode const&, /// @brief function TO_BOOL AqlValue Functions::ToBool(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& a = extractFunctionParameterValue(parameters, 0); return AqlValue(AqlValueHintBool(a.toBoolean())); } /// @brief function TO_ARRAY AqlValue Functions::ToArray(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (value.isArray()) { @@ -1979,7 +1977,7 @@ AqlValue Functions::ToArray(ExpressionContext* ctx, AstNode const&, /// @brief function LENGTH AqlValue Functions::Length(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (value.isArray()) { // shortcut! @@ -2018,7 +2016,7 @@ AqlValue Functions::Length(ExpressionContext*, AstNode const&, /// FIND_FIRST(text, search, start, end) → position AqlValue Functions::FindFirst(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "FIND_FIRST"; auto* trx = &expressionContext->trx(); @@ -2091,7 +2089,7 @@ AqlValue Functions::FindFirst(ExpressionContext* expressionContext, /// FIND_FIRST(text, search, start, end) → position AqlValue Functions::FindLast(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "FIND_LAST"; auto* trx = &expressionContext->trx(); @@ -2166,7 +2164,7 @@ AqlValue Functions::FindLast(ExpressionContext* expressionContext, /// @brief function REVERSE AqlValue Functions::Reverse(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "REVERSE"; transaction::Methods* trx = &expressionContext->trx(); @@ -2218,7 +2216,7 @@ AqlValue Functions::Reverse(ExpressionContext* expressionContext, /// @brief function FIRST AqlValue Functions::First(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "FIRST"; @@ -2240,7 +2238,7 @@ AqlValue Functions::First(ExpressionContext* expressionContext, AstNode const&, /// @brief function LAST AqlValue Functions::Last(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "LAST"; @@ -2264,7 +2262,7 @@ AqlValue Functions::Last(ExpressionContext* expressionContext, AstNode const&, /// @brief function NTH AqlValue Functions::Nth(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "NTH"; @@ -2295,7 +2293,7 @@ AqlValue Functions::Nth(ExpressionContext* expressionContext, AstNode const&, /// @brief function CONTAINS AqlValue Functions::Contains(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto* trx = &ctx->trx(); auto const& vopts = trx->vpackOptions(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -2360,7 +2358,7 @@ AqlValue Functions::Contains(ExpressionContext* ctx, AstNode const&, /// @brief function CONCAT AqlValue Functions::Concat(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &ctx->trx(); auto const& vopts = trx->vpackOptions(); transaction::StringLeaser buffer(trx); @@ -2401,7 +2399,7 @@ AqlValue Functions::Concat(ExpressionContext* ctx, AstNode const&, /// @brief function CONCAT_SEPARATOR AqlValue Functions::ConcatSeparator(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &ctx->trx(); auto const& vopts = trx->vpackOptions(); transaction::StringLeaser buffer(trx); @@ -2463,7 +2461,7 @@ AqlValue Functions::ConcatSeparator(ExpressionContext* ctx, AstNode const&, /// @brief function CHAR_LENGTH AqlValue Functions::CharLength(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &ctx->trx(); auto* vopts = &trx->vpackOptions(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -2511,7 +2509,7 @@ AqlValue Functions::CharLength(ExpressionContext* ctx, AstNode const&, /// @brief function LOWER AqlValue Functions::Lower(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { std::string utf8; transaction::Methods* trx = &ctx->trx(); auto const& vopts = trx->vpackOptions(); @@ -2532,7 +2530,7 @@ AqlValue Functions::Lower(ExpressionContext* ctx, AstNode const&, /// @brief function UPPER AqlValue Functions::Upper(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { std::string utf8; transaction::Methods* trx = &ctx->trx(); auto const& vopts = trx->vpackOptions(); @@ -2553,7 +2551,7 @@ AqlValue Functions::Upper(ExpressionContext* ctx, AstNode const&, /// @brief function SUBSTRING AqlValue Functions::Substring(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &ctx->trx(); auto const& vopts = trx->vpackOptions(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -2594,7 +2592,7 @@ AqlValue Functions::Substring(ExpressionContext* ctx, AstNode const&, AqlValue Functions::Substitute(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "SUBSTITUTE"; transaction::Methods* trx = &expressionContext->trx(); @@ -2857,7 +2855,7 @@ AqlValue Functions::Substitute(ExpressionContext* expressionContext, /// @brief function LEFT str, length AqlValue Functions::Left(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &ctx->trx(); auto const& vopts = trx->vpackOptions(); AqlValue value = extractFunctionParameterValue(parameters, 0); @@ -2881,7 +2879,7 @@ AqlValue Functions::Left(ExpressionContext* ctx, AstNode const&, /// @brief function RIGHT AqlValue Functions::Right(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &ctx->trx(); auto const& vopts = trx->vpackOptions(); AqlValue value = extractFunctionParameterValue(parameters, 0); @@ -2951,7 +2949,7 @@ void rtrimInternal(int32_t& startOffset, int32_t& endOffset, /// @brief function TRIM AqlValue Functions::Trim(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "TRIM"; @@ -3015,7 +3013,7 @@ AqlValue Functions::Trim(ExpressionContext* expressionContext, AstNode const&, /// @brief function LTRIM AqlValue Functions::LTrim(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "LTRIM"; @@ -3061,7 +3059,7 @@ AqlValue Functions::LTrim(ExpressionContext* expressionContext, AstNode const&, /// @brief function RTRIM AqlValue Functions::RTrim(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "RTRIM"; @@ -3107,7 +3105,7 @@ AqlValue Functions::RTrim(ExpressionContext* expressionContext, AstNode const&, /// @brief function LIKE AqlValue Functions::Like(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "LIKE"; transaction::Methods* trx = &expressionContext->trx(); @@ -3150,7 +3148,7 @@ AqlValue Functions::Like(ExpressionContext* expressionContext, AstNode const&, /// @brief function SPLIT AqlValue Functions::Split(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "SPLIT"; transaction::Methods* trx = &expressionContext->trx(); @@ -3289,7 +3287,7 @@ AqlValue Functions::Split(ExpressionContext* expressionContext, AstNode const&, /// @brief function REGEX_MATCHES AqlValue Functions::RegexMatches(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "REGEX_MATCHES"; transaction::Methods* trx = &expressionContext->trx(); @@ -3368,7 +3366,7 @@ AqlValue Functions::RegexMatches(ExpressionContext* expressionContext, /// @brief function REGEX_SPLIT AqlValue Functions::RegexSplit(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "REGEX_SPLIT"; transaction::Methods* trx = &expressionContext->trx(); @@ -3501,7 +3499,7 @@ AqlValue Functions::RegexSplit(ExpressionContext* expressionContext, /// @brief function REGEX_TEST AqlValue Functions::RegexTest(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "REGEX_TEST"; transaction::Methods* trx = &expressionContext->trx(); @@ -3545,7 +3543,7 @@ AqlValue Functions::RegexTest(ExpressionContext* expressionContext, /// @brief function REGEX_REPLACE AqlValue Functions::RegexReplace(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "REGEX_REPLACE"; transaction::Methods* trx = &expressionContext->trx(); @@ -3593,7 +3591,7 @@ AqlValue Functions::RegexReplace(ExpressionContext* expressionContext, /// @brief function DATE_NOW AqlValue Functions::DateNow(ExpressionContext*, AstNode const&, - VPackFunctionParameters const&) { + VPackFunctionParametersView) { auto millis = std::chrono::duration_cast>( system_clock::now().time_since_epoch()); uint64_t dur = millis.count(); @@ -3603,7 +3601,7 @@ AqlValue Functions::DateNow(ExpressionContext*, AstNode const&, /// @brief function DATE_ISO8601 AqlValue Functions::DateIso8601(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_ISO8601"; return ::dateFromParameters(expressionContext, parameters, AFN, false); } @@ -3611,14 +3609,14 @@ AqlValue Functions::DateIso8601(ExpressionContext* expressionContext, /// @brief function DATE_TIMESTAMP AqlValue Functions::DateTimestamp(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_TIMESTAMP"; return ::dateFromParameters(expressionContext, parameters, AFN, true); } /// @brief function IS_DATESTRING AqlValue Functions::IsDatestring(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); bool isValid = false; @@ -3634,7 +3632,7 @@ AqlValue Functions::IsDatestring(ExpressionContext*, AstNode const&, /// @brief function DATE_DAYOFWEEK AqlValue Functions::DateDayOfWeek(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_DAYOFWEEK"; tp_sys_clock_ms tp; if (!::parameterToTimePoint(expressionContext, parameters, tp, AFN, 0)) { @@ -3648,7 +3646,7 @@ AqlValue Functions::DateDayOfWeek(ExpressionContext* expressionContext, /// @brief function DATE_YEAR AqlValue Functions::DateYear(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_YEAR"; tp_sys_clock_ms tp; @@ -3664,7 +3662,7 @@ AqlValue Functions::DateYear(ExpressionContext* expressionContext, /// @brief function DATE_MONTH AqlValue Functions::DateMonth(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_MONTH"; tp_sys_clock_ms tp; @@ -3680,7 +3678,7 @@ AqlValue Functions::DateMonth(ExpressionContext* expressionContext, /// @brief function DATE_DAY AqlValue Functions::DateDay(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_DAY"; tp_sys_clock_ms tp; @@ -3697,7 +3695,7 @@ AqlValue Functions::DateDay(ExpressionContext* expressionContext, /// @brief function DATE_HOUR AqlValue Functions::DateHour(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_HOUR"; tp_sys_clock_ms tp; @@ -3713,7 +3711,7 @@ AqlValue Functions::DateHour(ExpressionContext* expressionContext, /// @brief function DATE_MINUTE AqlValue Functions::DateMinute(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_MINUTE"; tp_sys_clock_ms tp; @@ -3729,7 +3727,7 @@ AqlValue Functions::DateMinute(ExpressionContext* expressionContext, /// @brief function DATE_SECOND AqlValue Functions::DateSecond(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_SECOND"; tp_sys_clock_ms tp; @@ -3745,7 +3743,7 @@ AqlValue Functions::DateSecond(ExpressionContext* expressionContext, /// @brief function DATE_MILLISECOND AqlValue Functions::DateMillisecond(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_MILLISECOND"; tp_sys_clock_ms tp; @@ -3760,7 +3758,7 @@ AqlValue Functions::DateMillisecond(ExpressionContext* expressionContext, /// @brief function DATE_DAYOFYEAR AqlValue Functions::DateDayOfYear(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_DAYOFYEAR"; tp_sys_clock_ms tp; @@ -3781,7 +3779,7 @@ AqlValue Functions::DateDayOfYear(ExpressionContext* expressionContext, /// @brief function DATE_ISOWEEK AqlValue Functions::DateIsoWeek(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_ISOWEEK"; tp_sys_clock_ms tp; @@ -3798,7 +3796,7 @@ AqlValue Functions::DateIsoWeek(ExpressionContext* expressionContext, /// @brief function DATE_LEAPYEAR AqlValue Functions::DateLeapYear(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_LEAPYEAR"; tp_sys_clock_ms tp; @@ -3814,7 +3812,7 @@ AqlValue Functions::DateLeapYear(ExpressionContext* expressionContext, /// @brief function DATE_QUARTER AqlValue Functions::DateQuarter(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_QUARTER"; tp_sys_clock_ms tp; @@ -3835,7 +3833,7 @@ AqlValue Functions::DateQuarter(ExpressionContext* expressionContext, /// @brief function DATE_DAYS_IN_MONTH AqlValue Functions::DateDaysInMonth(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_DAYS_IN_MONTH"; tp_sys_clock_ms tp; @@ -3854,7 +3852,7 @@ AqlValue Functions::DateDaysInMonth(ExpressionContext* expressionContext, /// @brief function DATE_TRUNC AqlValue Functions::DateTrunc(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_TRUNC"; tp_sys_clock_ms tp; @@ -3905,7 +3903,7 @@ AqlValue Functions::DateTrunc(ExpressionContext* expressionContext, /// @brief function DATE_UTCTOLOCAL AqlValue Functions::DateUtcToLocal(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_UTCTOLOCAL"; tp_sys_clock_ms tp_utc; @@ -3980,7 +3978,7 @@ AqlValue Functions::DateUtcToLocal(ExpressionContext* expressionContext, /// @brief function DATE_LOCALTOUTC AqlValue Functions::DateLocalToUtc(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_LOCALTOUTC"; tp_sys_clock_ms tp_local; @@ -4054,7 +4052,7 @@ AqlValue Functions::DateLocalToUtc(ExpressionContext* expressionContext, /// @brief function DATE_TIMEZONE AqlValue Functions::DateTimeZone(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto const* zone = date::current_zone(); if (zone != nullptr) { @@ -4067,7 +4065,7 @@ AqlValue Functions::DateTimeZone(ExpressionContext* expressionContext, /// @brief function DATE_TIMEZONES AqlValue Functions::DateTimeZones(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto& list = date::get_tzdb_list(); auto& db = list.front(); @@ -4090,7 +4088,7 @@ AqlValue Functions::DateTimeZones(ExpressionContext* expressionContext, /// @brief function DATE_ADD AqlValue Functions::DateAdd(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_ADD"; tp_sys_clock_ms tp; @@ -4133,7 +4131,7 @@ AqlValue Functions::DateAdd(ExpressionContext* expressionContext, /// @brief function DATE_SUBTRACT AqlValue Functions::DateSubtract(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_SUBTRACT"; tp_sys_clock_ms tp; @@ -4176,7 +4174,7 @@ AqlValue Functions::DateSubtract(ExpressionContext* expressionContext, /// @brief function DATE_DIFF AqlValue Functions::DateDiff(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_DIFF"; // Extract first date tp_sys_clock_ms tp1; @@ -4267,7 +4265,7 @@ AqlValue Functions::DateDiff(ExpressionContext* expressionContext, /// @brief function DATE_COMPARE AqlValue Functions::DateCompare(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_COMPARE"; tp_sys_clock_ms tp1; if (!::parameterToTimePoint(expressionContext, parameters, tp1, AFN, 0)) { @@ -4388,7 +4386,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext, /// @brief function DATE_ROUND AqlValue Functions::DateRound(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DATE_ROUND"; tp_sys_clock_ms tp; @@ -4444,7 +4442,7 @@ AqlValue Functions::DateRound(ExpressionContext* expressionContext, /// @brief function PASSTHRU AqlValue Functions::Passthru(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { if (parameters.empty()) { return AqlValue(AqlValueHintNull()); } @@ -4454,7 +4452,7 @@ AqlValue Functions::Passthru(ExpressionContext*, AstNode const&, /// @brief function UNSET AqlValue Functions::Unset(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "UNSET"; AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -4479,7 +4477,7 @@ AqlValue Functions::Unset(ExpressionContext* expressionContext, AstNode const&, /// @brief function UNSET_RECURSIVE AqlValue Functions::UnsetRecursive(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "UNSET_RECURSIVE"; AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -4504,7 +4502,7 @@ AqlValue Functions::UnsetRecursive(ExpressionContext* expressionContext, /// @brief function KEEP AqlValue Functions::Keep(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "KEEP"; AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -4530,7 +4528,7 @@ AqlValue Functions::Keep(ExpressionContext* expressionContext, AstNode const&, /// @brief function KEEP_RECURSIVE AqlValue Functions::KeepRecursive(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "KEEP_RECURSIVE"; AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -4556,7 +4554,7 @@ AqlValue Functions::KeepRecursive(ExpressionContext* expressionContext, /// @brief function TRANSLATE AqlValue Functions::Translate(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "TRANSLATE"; @@ -4599,21 +4597,21 @@ AqlValue Functions::Translate(ExpressionContext* expressionContext, /// @brief function MERGE AqlValue Functions::Merge(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { return ::mergeParameters(expressionContext, parameters, "MERGE", false); } /// @brief function MERGE_RECURSIVE AqlValue Functions::MergeRecursive(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { return ::mergeParameters(expressionContext, parameters, "MERGE_RECURSIVE", true); } /// @brief function HAS AqlValue Functions::Has(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { size_t const n = parameters.size(); if (n < 2) { // no parameters @@ -4642,7 +4640,7 @@ AqlValue Functions::Has(ExpressionContext* expressionContext, AstNode const&, /// @brief function ATTRIBUTES AqlValue Functions::Attributes(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { size_t const n = parameters.size(); if (n < 1) { @@ -4709,7 +4707,7 @@ AqlValue Functions::Attributes(ExpressionContext* expressionContext, /// @brief function VALUES AqlValue Functions::Values(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { size_t const n = parameters.size(); if (n < 1) { @@ -4765,7 +4763,7 @@ AqlValue Functions::Values(ExpressionContext* expressionContext, AstNode const&, /// @brief function MIN AqlValue Functions::Min(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (!value.isArray()) { @@ -4799,7 +4797,7 @@ AqlValue Functions::Min(ExpressionContext* expressionContext, AstNode const&, /// @brief function MAX AqlValue Functions::Max(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (!value.isArray()) { @@ -4829,7 +4827,7 @@ AqlValue Functions::Max(ExpressionContext* expressionContext, AstNode const&, /// @brief function SUM AqlValue Functions::Sum(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (!value.isArray()) { @@ -4864,7 +4862,7 @@ AqlValue Functions::Sum(ExpressionContext* expressionContext, AstNode const&, /// @brief function AVERAGE AqlValue Functions::Average(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "AVERAGE"; AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -4910,7 +4908,7 @@ AqlValue Functions::Average(ExpressionContext* expressionContext, /// @brief function PRODUCT AqlValue Functions::Product(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (!value.isArray()) { @@ -4945,7 +4943,7 @@ AqlValue Functions::Product(ExpressionContext* expressionContext, /// @brief function SLEEP AqlValue Functions::Sleep(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (!value.isNumber() || value.toDouble() < 0) { @@ -4976,7 +4974,7 @@ AqlValue Functions::Sleep(ExpressionContext* expressionContext, AstNode const&, /// @brief function COLLECTIONS AqlValue Functions::Collections(ExpressionContext* exprCtx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::BuilderLeaser builder(&exprCtx->trx()); builder->openArray(); @@ -5006,7 +5004,7 @@ AqlValue Functions::Collections(ExpressionContext* exprCtx, AstNode const&, /// @brief function RANDOM_TOKEN AqlValue Functions::RandomToken(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); int64_t const length = value.toInt64(); @@ -5023,7 +5021,7 @@ AqlValue Functions::RandomToken(ExpressionContext*, AstNode const&, /// @brief function IPV4_FROM_NUMBER AqlValue Functions::IpV4FromNumber(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "IPV4_FROM_NUMBER"; AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -5069,7 +5067,7 @@ AqlValue Functions::IpV4FromNumber(ExpressionContext* expressionContext, /// @brief function IPV4_TO_NUMBER AqlValue Functions::IpV4ToNumber(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "IPV4_TO_NUMBER"; transaction::Methods* trx = &expressionContext->trx(); @@ -5129,7 +5127,7 @@ AqlValue Functions::IpV4ToNumber(ExpressionContext* expressionContext, /// @brief function IS_IPV4 AqlValue Functions::IsIpV4(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); auto* vopts = &trx->vpackOptions(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -5181,7 +5179,7 @@ AqlValue Functions::IsIpV4(ExpressionContext* expressionContext, AstNode const&, /// @brief function MD5 AqlValue Functions::Md5(ExpressionContext* exprCtx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &exprCtx->trx(); auto const& vopts = trx->vpackOptions(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -5209,7 +5207,7 @@ AqlValue Functions::Md5(ExpressionContext* exprCtx, AstNode const&, /// @brief function SHA1 AqlValue Functions::Sha1(ExpressionContext* exprCtx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &exprCtx->trx(); auto const& vopts = trx->vpackOptions(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -5237,7 +5235,7 @@ AqlValue Functions::Sha1(ExpressionContext* exprCtx, AstNode const&, /// @brief function SHA512 AqlValue Functions::Sha512(ExpressionContext* exprCtx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &exprCtx->trx(); auto const& vopts = trx->vpackOptions(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -5265,7 +5263,7 @@ AqlValue Functions::Sha512(ExpressionContext* exprCtx, AstNode const&, /// @brief function Crc32 AqlValue Functions::Crc32(ExpressionContext* exprCtx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &exprCtx->trx(); auto const& vopts = trx->vpackOptions(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -5282,7 +5280,7 @@ AqlValue Functions::Crc32(ExpressionContext* exprCtx, AstNode const&, /// @brief function Fnv64 AqlValue Functions::Fnv64(ExpressionContext* exprCtx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &exprCtx->trx(); auto const& vopts = trx->vpackOptions(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -5299,7 +5297,7 @@ AqlValue Functions::Fnv64(ExpressionContext* exprCtx, AstNode const&, /// @brief function HASH AqlValue Functions::Hash(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); // throw away the top bytes so the hash value can safely be used @@ -5311,7 +5309,7 @@ AqlValue Functions::Hash(ExpressionContext*, AstNode const&, /// @brief function IS_KEY AqlValue Functions::IsKey(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (!value.isString()) { // not a string, so no valid key @@ -5326,7 +5324,7 @@ AqlValue Functions::IsKey(ExpressionContext*, AstNode const&, /// @brief function COUNT_DISTINCT AqlValue Functions::CountDistinct(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "COUNT_DISTINCT"; @@ -5361,7 +5359,7 @@ AqlValue Functions::CountDistinct(ExpressionContext* expressionContext, /// @brief function UNIQUE AqlValue Functions::Unique(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "UNIQUE"; @@ -5407,7 +5405,7 @@ AqlValue Functions::Unique(ExpressionContext* expressionContext, AstNode const&, /// @brief function SORTED_UNIQUE AqlValue Functions::SortedUnique(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "SORTED_UNIQUE"; @@ -5445,7 +5443,7 @@ AqlValue Functions::SortedUnique(ExpressionContext* expressionContext, /// @brief function SORTED AqlValue Functions::Sorted(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "SORTED"; @@ -5489,7 +5487,7 @@ AqlValue Functions::Sorted(ExpressionContext* expressionContext, AstNode const&, /// @brief function UNION AqlValue Functions::Union(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "UNION"; transaction::Methods* trx = &expressionContext->trx(); @@ -5532,7 +5530,7 @@ AqlValue Functions::Union(ExpressionContext* expressionContext, AstNode const&, /// @brief function UNION_DISTINCT AqlValue Functions::UnionDistinct(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "UNION_DISTINCT"; transaction::Methods* trx = &expressionContext->trx(); @@ -5592,7 +5590,7 @@ AqlValue Functions::UnionDistinct(ExpressionContext* expressionContext, /// @brief function INTERSECTION AqlValue Functions::Intersection(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "INTERSECTION"; transaction::Methods* trx = &expressionContext->trx(); @@ -5663,7 +5661,7 @@ AqlValue Functions::Intersection(ExpressionContext* expressionContext, /// @brief function JACCARD AqlValue Functions::Jaccard(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const& args) { + VPackFunctionParametersView args) { static char const* AFN = "JACCARD"; typedef std::unordered_maptrx(); @@ -5778,7 +5776,7 @@ AqlValue Functions::Outersection(ExpressionContext* expressionContext, /// @brief function DISTANCE AqlValue Functions::Distance(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "DISTANCE"; AqlValue const& lat1 = extractFunctionParameterValue(parameters, 0); @@ -5832,7 +5830,7 @@ AqlValue Functions::Distance(ExpressionContext* expressionContext, /// @brief function GEO_DISTANCE AqlValue Functions::GeoDistance(ExpressionContext* exprCtx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { constexpr char const AFN[] = "GEO_DISTANCE"; geo::ShapeContainer shape1, shape2; @@ -5864,7 +5862,7 @@ AqlValue Functions::GeoDistance(ExpressionContext* exprCtx, AstNode const&, /// @brief function GEO_IN_RANGE AqlValue Functions::GeoInRange(ExpressionContext* ctx, AstNode const& node, - VPackFunctionParameters const& args) { + VPackFunctionParametersView args) { TRI_ASSERT(ctx); TRI_ASSERT(aql::NODE_TYPE_FCALL == node.type); @@ -5966,7 +5964,7 @@ AqlValue Functions::GeoInRange(ExpressionContext* ctx, AstNode const& node, /// @brief function GEO_CONTAINS AqlValue Functions::GeoContains(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { return ::geoContainsIntersect(expressionContext, node, parameters, "GEO_CONTAINS", true); } @@ -5974,7 +5972,7 @@ AqlValue Functions::GeoContains(ExpressionContext* expressionContext, /// @brief function GEO_INTERSECTS AqlValue Functions::GeoIntersects(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { return ::geoContainsIntersect(expressionContext, node, parameters, "GEO_INTERSECTS", false); } @@ -5982,7 +5980,7 @@ AqlValue Functions::GeoIntersects(ExpressionContext* expressionContext, /// @brief function GEO_EQUALS AqlValue Functions::GeoEquals(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); auto* vopts = &trx->vpackOptions(); AqlValue p1 = extractFunctionParameterValue(parameters, 0); @@ -6018,7 +6016,7 @@ AqlValue Functions::GeoEquals(ExpressionContext* expressionContext, /// @brief function GEO_AREA AqlValue Functions::GeoArea(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); auto* vopts = &trx->vpackOptions(); AqlValue p1 = extractFunctionParameterValue(parameters, 0); @@ -6048,7 +6046,7 @@ AqlValue Functions::GeoArea(ExpressionContext* expressionContext, /// @brief function IS_IN_POLYGON AqlValue Functions::IsInPolygon(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); auto* vopts = &trx->vpackOptions(); AqlValue const& coords = extractFunctionParameterValue(parameters, 0); @@ -6110,7 +6108,7 @@ AqlValue Functions::IsInPolygon(ExpressionContext* expressionContext, /// @brief function GEO_POINT AqlValue Functions::GeoPoint(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); size_t const n = parameters.size(); @@ -6157,7 +6155,7 @@ AqlValue Functions::GeoPoint(ExpressionContext* expressionContext, /// @brief function GEO_MULTIPOINT AqlValue Functions::GeoMultiPoint(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); auto* vopts = &trx->vpackOptions(); size_t const n = parameters.size(); @@ -6221,7 +6219,7 @@ AqlValue Functions::GeoMultiPoint(ExpressionContext* expressionContext, /// @brief function GEO_POLYGON AqlValue Functions::GeoPolygon(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); auto* vopts = &trx->vpackOptions(); size_t const n = parameters.size(); @@ -6270,7 +6268,7 @@ AqlValue Functions::GeoPolygon(ExpressionContext* expressionContext, /// @brief function GEO_MULTIPOLYGON AqlValue Functions::GeoMultiPolygon(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); auto* vopts = &trx->vpackOptions(); size_t const n = parameters.size(); @@ -6354,7 +6352,7 @@ AqlValue Functions::GeoMultiPolygon(ExpressionContext* expressionContext, /// @brief function GEO_LINESTRING AqlValue Functions::GeoLinestring(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); auto* vopts = &trx->vpackOptions(); size_t const n = parameters.size(); @@ -6416,9 +6414,9 @@ AqlValue Functions::GeoLinestring(ExpressionContext* expressionContext, } /// @brief function GEO_MULTILINESTRING -AqlValue Functions::GeoMultiLinestring( - ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { +AqlValue Functions::GeoMultiLinestring(ExpressionContext* expressionContext, + AstNode const&, + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); auto* vopts = &trx->vpackOptions(); size_t const n = parameters.size(); @@ -6502,7 +6500,7 @@ AqlValue Functions::GeoMultiLinestring( /// @brief function FLATTEN AqlValue Functions::Flatten(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); auto* vopts = &trx->vpackOptions(); // cppcheck-suppress variableScope @@ -6539,7 +6537,7 @@ AqlValue Functions::Flatten(ExpressionContext* expressionContext, /// @brief function ZIP AqlValue Functions::Zip(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "ZIP"; @@ -6598,7 +6596,7 @@ AqlValue Functions::Zip(ExpressionContext* expressionContext, AstNode const&, /// @brief function JSON_STRINGIFY AqlValue Functions::JsonStringify(ExpressionContext* exprCtx, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &exprCtx->trx(); auto* vopts = &trx->vpackOptions(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -6617,7 +6615,7 @@ AqlValue Functions::JsonStringify(ExpressionContext* exprCtx, AstNode const&, /// @brief function JSON_PARSE AqlValue Functions::JsonParse(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "JSON_PARSE"; transaction::Methods* trx = &expressionContext->trx(); @@ -6648,7 +6646,7 @@ AqlValue Functions::JsonParse(ExpressionContext* expressionContext, /// @brief function PARSE_IDENTIFIER AqlValue Functions::ParseIdentifier(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "PARSE_IDENTIFIER"; transaction::Methods* trx = &expressionContext->trx(); @@ -6696,7 +6694,7 @@ AqlValue Functions::ParseIdentifier(ExpressionContext* expressionContext, /// @brief function Slice AqlValue Functions::Slice(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "SLICE"; @@ -6764,7 +6762,7 @@ AqlValue Functions::Slice(ExpressionContext* expressionContext, AstNode const&, /// @brief function Minus AqlValue Functions::Minus(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "MINUS"; transaction::Methods* trx = &expressionContext->trx(); @@ -6829,7 +6827,7 @@ AqlValue Functions::Minus(ExpressionContext* expressionContext, AstNode const&, /// @brief function Document AqlValue Functions::Document(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "DOCUMENT"; @@ -6916,7 +6914,7 @@ AqlValue Functions::Document(ExpressionContext* expressionContext, /// @brief function MATCHES AqlValue Functions::Matches(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "MATCHES"; transaction::Methods* trx = &expressionContext->trx(); @@ -7002,7 +7000,7 @@ AqlValue Functions::Matches(ExpressionContext* expressionContext, /// @brief function ROUND AqlValue Functions::Round(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7013,7 +7011,7 @@ AqlValue Functions::Round(ExpressionContext*, AstNode const&, /// @brief function ABS AqlValue Functions::Abs(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7022,7 +7020,7 @@ AqlValue Functions::Abs(ExpressionContext*, AstNode const&, /// @brief function CEIL AqlValue Functions::Ceil(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7031,7 +7029,7 @@ AqlValue Functions::Ceil(ExpressionContext*, AstNode const&, /// @brief function FLOOR AqlValue Functions::Floor(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7040,7 +7038,7 @@ AqlValue Functions::Floor(ExpressionContext*, AstNode const&, /// @brief function SQRT AqlValue Functions::Sqrt(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7049,7 +7047,7 @@ AqlValue Functions::Sqrt(ExpressionContext*, AstNode const&, /// @brief function POW AqlValue Functions::Pow(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& baseValue = extractFunctionParameterValue(parameters, 0); AqlValue const& expValue = extractFunctionParameterValue(parameters, 1); @@ -7061,7 +7059,7 @@ AqlValue Functions::Pow(ExpressionContext*, AstNode const&, /// @brief function LOG AqlValue Functions::Log(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7070,7 +7068,7 @@ AqlValue Functions::Log(ExpressionContext*, AstNode const&, /// @brief function LOG2 AqlValue Functions::Log2(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7079,7 +7077,7 @@ AqlValue Functions::Log2(ExpressionContext*, AstNode const&, /// @brief function LOG10 AqlValue Functions::Log10(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7088,7 +7086,7 @@ AqlValue Functions::Log10(ExpressionContext*, AstNode const&, /// @brief function EXP AqlValue Functions::Exp(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7097,7 +7095,7 @@ AqlValue Functions::Exp(ExpressionContext*, AstNode const&, /// @brief function EXP2 AqlValue Functions::Exp2(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7106,7 +7104,7 @@ AqlValue Functions::Exp2(ExpressionContext*, AstNode const&, /// @brief function SIN AqlValue Functions::Sin(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7115,7 +7113,7 @@ AqlValue Functions::Sin(ExpressionContext*, AstNode const&, /// @brief function COS AqlValue Functions::Cos(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7124,7 +7122,7 @@ AqlValue Functions::Cos(ExpressionContext*, AstNode const&, /// @brief function TAN AqlValue Functions::Tan(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7133,7 +7131,7 @@ AqlValue Functions::Tan(ExpressionContext*, AstNode const&, /// @brief function ASIN AqlValue Functions::Asin(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7142,7 +7140,7 @@ AqlValue Functions::Asin(ExpressionContext*, AstNode const&, /// @brief function ACOS AqlValue Functions::Acos(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7151,7 +7149,7 @@ AqlValue Functions::Acos(ExpressionContext*, AstNode const&, /// @brief function ATAN AqlValue Functions::Atan(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double input = value.toDouble(); @@ -7160,7 +7158,7 @@ AqlValue Functions::Atan(ExpressionContext*, AstNode const&, /// @brief function ATAN2 AqlValue Functions::Atan2(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue value1 = extractFunctionParameterValue(parameters, 0); AqlValue value2 = extractFunctionParameterValue(parameters, 1); @@ -7171,7 +7169,7 @@ AqlValue Functions::Atan2(ExpressionContext*, AstNode const&, /// @brief function RADIANS AqlValue Functions::Radians(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double degrees = value.toDouble(); @@ -7181,7 +7179,7 @@ AqlValue Functions::Radians(ExpressionContext*, AstNode const&, /// @brief function DEGREES AqlValue Functions::Degrees(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); double radians = value.toDouble(); @@ -7191,7 +7189,7 @@ AqlValue Functions::Degrees(ExpressionContext*, AstNode const&, /// @brief function PI AqlValue Functions::Pi(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // acos(-1) == PI return ::numberValue(std::acos(-1.0), true); } @@ -7213,7 +7211,7 @@ std::optional bitOperationValue(VPackSlice input) { AqlValue handleBitOperation( ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters, + VPackFunctionParametersView parameters, std::function const& cb) { TRI_ASSERT(aql::NODE_TYPE_FCALL == node.type); @@ -7284,7 +7282,7 @@ AqlValue handleBitOperation( /// @brief function BIT_AND AqlValue Functions::BitAnd(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { return handleBitOperation( expressionContext, node, parameters, [](uint64_t value1, uint64_t value2) { return value1 & value2; }); @@ -7293,7 +7291,7 @@ AqlValue Functions::BitAnd(ExpressionContext* expressionContext, /// @brief function BIT_OR AqlValue Functions::BitOr(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { return handleBitOperation( expressionContext, node, parameters, [](uint64_t value1, uint64_t value2) { return value1 | value2; }); @@ -7302,7 +7300,7 @@ AqlValue Functions::BitOr(ExpressionContext* expressionContext, /// @brief function BIT_XOR AqlValue Functions::BitXOr(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { return handleBitOperation( expressionContext, node, parameters, [](uint64_t value1, uint64_t value2) { return value1 ^ value2; }); @@ -7310,7 +7308,7 @@ AqlValue Functions::BitXOr(ExpressionContext* expressionContext, template std::optional> binaryBitFunctionParameters( - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value1 = extractFunctionParameterValue(parameters, 0); if (value1.isNumber()) { auto result1 = bitOperationValue(value1.slice()); @@ -7334,7 +7332,7 @@ std::optional> binaryBitFunctionParameters( /// @brief function BIT_NEGATE AqlValue Functions::BitNegate(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto result = binaryBitFunctionParameters(parameters); if (result.has_value()) { auto [testee, width] = result.value(); @@ -7351,7 +7349,7 @@ AqlValue Functions::BitNegate(ExpressionContext* expressionContext, /// @brief function BIT_TEST AqlValue Functions::BitTest(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto result = binaryBitFunctionParameters(parameters); if (result.has_value()) { auto [testee, index] = result.value(); @@ -7368,7 +7366,7 @@ AqlValue Functions::BitTest(ExpressionContext* expressionContext, /// @brief function BIT_SHIFT_LEFT AqlValue Functions::BitShiftLeft(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto result = binaryBitFunctionParameters(parameters); if (result.has_value()) { auto [testee, shift] = result.value(); @@ -7393,7 +7391,7 @@ AqlValue Functions::BitShiftLeft(ExpressionContext* expressionContext, /// @brief function BIT_SHIFT_RIGHT AqlValue Functions::BitShiftRight(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto result = binaryBitFunctionParameters(parameters); if (result.has_value()) { auto [testee, shift] = result.value(); @@ -7418,7 +7416,7 @@ AqlValue Functions::BitShiftRight(ExpressionContext* expressionContext, /// @brief function BIT_POPCOUNT AqlValue Functions::BitPopcount(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (value.isNumber()) { @@ -7438,7 +7436,7 @@ AqlValue Functions::BitPopcount(ExpressionContext* expressionContext, AqlValue Functions::BitConstruct(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "BIT_CONSTRUCT"; AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -7474,7 +7472,7 @@ AqlValue Functions::BitConstruct(ExpressionContext* expressionContext, AqlValue Functions::BitDeconstruct(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (value.isNumber()) { @@ -7505,7 +7503,7 @@ AqlValue Functions::BitDeconstruct(ExpressionContext* expressionContext, /// @brief function BIT_TO_STRING AqlValue Functions::BitToString(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto result = binaryBitFunctionParameters(parameters); if (result.has_value()) { auto [testee, index] = result.value(); @@ -7534,7 +7532,7 @@ AqlValue Functions::BitToString(ExpressionContext* expressionContext, /// @brief function BIT_FROM_STRING AqlValue Functions::BitFromString(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "BIT_FROM_STRING"; AqlValue const& value = extractFunctionParameterValue(parameters, 0); @@ -7568,14 +7566,14 @@ AqlValue Functions::BitFromString(ExpressionContext* expressionContext, /// @brief function RAND AqlValue Functions::Rand(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // This random functionality is not too good yet... return ::numberValue(static_cast(std::rand()) / RAND_MAX, true); } /// @brief function FIRST_DOCUMENT AqlValue Functions::FirstDocument(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { size_t const n = parameters.size(); for (size_t i = 0; i < n; ++i) { AqlValue const& a = extractFunctionParameterValue(parameters, i); @@ -7589,7 +7587,7 @@ AqlValue Functions::FirstDocument(ExpressionContext*, AstNode const&, /// @brief function FIRST_LIST AqlValue Functions::FirstList(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { size_t const n = parameters.size(); for (size_t i = 0; i < n; ++i) { AqlValue const& a = extractFunctionParameterValue(parameters, i); @@ -7603,7 +7601,7 @@ AqlValue Functions::FirstList(ExpressionContext*, AstNode const&, /// @brief function PUSH AqlValue Functions::Push(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "PUSH"; @@ -7651,7 +7649,7 @@ AqlValue Functions::Push(ExpressionContext* expressionContext, AstNode const&, /// @brief function POP AqlValue Functions::Pop(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "POP"; @@ -7685,7 +7683,7 @@ AqlValue Functions::Pop(ExpressionContext* expressionContext, AstNode const&, /// @brief function APPEND AqlValue Functions::Append(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "APPEND"; @@ -7759,7 +7757,7 @@ AqlValue Functions::Append(ExpressionContext* expressionContext, AstNode const&, /// @brief function UNSHIFT AqlValue Functions::Unshift(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "UNSHIFT"; @@ -7806,7 +7804,7 @@ AqlValue Functions::Unshift(ExpressionContext* expressionContext, /// @brief function SHIFT AqlValue Functions::Shift(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "SHIFT"; @@ -7845,7 +7843,7 @@ AqlValue Functions::Shift(ExpressionContext* expressionContext, AstNode const&, /// @brief function REMOVE_VALUE AqlValue Functions::RemoveValue(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "REMOVE_VALUE"; @@ -7903,7 +7901,7 @@ AqlValue Functions::RemoveValue(ExpressionContext* expressionContext, /// @brief function REMOVE_VALUES AqlValue Functions::RemoveValues(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "REMOVE_VALUES"; @@ -7945,7 +7943,7 @@ AqlValue Functions::RemoveValues(ExpressionContext* expressionContext, /// @brief function REMOVE_NTH AqlValue Functions::RemoveNth(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "REMOVE_NTH"; @@ -7994,7 +7992,7 @@ AqlValue Functions::RemoveNth(ExpressionContext* expressionContext, /// @brief function ReplaceNth AqlValue Functions::ReplaceNth(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "REPLACE_NTH"; @@ -8066,7 +8064,7 @@ AqlValue Functions::ReplaceNth(ExpressionContext* expressionContext, /// @brief function NOT_NULL AqlValue Functions::NotNull(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { size_t const n = parameters.size(); for (size_t i = 0; i < n; ++i) { AqlValue const& element = extractFunctionParameterValue(parameters, i); @@ -8080,13 +8078,13 @@ AqlValue Functions::NotNull(ExpressionContext*, AstNode const&, /// @brief function CURRENT_DATABASE AqlValue Functions::CurrentDatabase(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { return AqlValue(expressionContext->vocbase().name()); } /// @brief function CURRENT_USER AqlValue Functions::CurrentUser(ExpressionContext*, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { std::string const& username = ExecContext::current().user(); if (username.empty()) { return AqlValue(AqlValueHintNull()); @@ -8097,7 +8095,7 @@ AqlValue Functions::CurrentUser(ExpressionContext*, AstNode const&, /// @brief function COLLECTION_COUNT AqlValue Functions::CollectionCount(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "COLLECTION_COUNT"; @@ -8124,7 +8122,7 @@ AqlValue Functions::CollectionCount(ExpressionContext* expressionContext, /// @brief function CHECK_DOCUMENT AqlValue Functions::CheckDocument(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); if (!value.isObject()) { // no document at all @@ -8142,7 +8140,7 @@ AqlValue Functions::CheckDocument(ExpressionContext* expressionContext, /// @brief function VARIANCE_SAMPLE AqlValue Functions::VarianceSample(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "VARIANCE_SAMPLE"; AqlValue const& list = extractFunctionParameterValue(parameters, 0); @@ -8171,9 +8169,9 @@ AqlValue Functions::VarianceSample(ExpressionContext* expressionContext, } /// @brief function VARIANCE_POPULATION -AqlValue Functions::VariancePopulation( - ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { +AqlValue Functions::VariancePopulation(ExpressionContext* expressionContext, + AstNode const&, + VPackFunctionParametersView parameters) { static char const* AFN = "VARIANCE_POPULATION"; AqlValue const& list = extractFunctionParameterValue(parameters, 0); @@ -8204,7 +8202,7 @@ AqlValue Functions::VariancePopulation( /// @brief function STDDEV_SAMPLE AqlValue Functions::StdDevSample(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "STDDEV_SAMPLE"; AqlValue const& list = extractFunctionParameterValue(parameters, 0); @@ -8233,9 +8231,9 @@ AqlValue Functions::StdDevSample(ExpressionContext* expressionContext, } /// @brief function STDDEV_POPULATION -AqlValue Functions::StdDevPopulation( - ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { +AqlValue Functions::StdDevPopulation(ExpressionContext* expressionContext, + AstNode const&, + VPackFunctionParametersView parameters) { static char const* AFN = "STDDEV_POPULATION"; AqlValue const& list = extractFunctionParameterValue(parameters, 0); @@ -8265,7 +8263,7 @@ AqlValue Functions::StdDevPopulation( /// @brief function MEDIAN AqlValue Functions::Median(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "MEDIAN"; AqlValue const& list = extractFunctionParameterValue(parameters, 0); @@ -8300,7 +8298,7 @@ AqlValue Functions::Median(ExpressionContext* expressionContext, AstNode const&, /// @brief function PERCENTILE AqlValue Functions::Percentile(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "PERCENTILE"; AqlValue const& list = extractFunctionParameterValue(parameters, 0); @@ -8399,7 +8397,7 @@ AqlValue Functions::Percentile(ExpressionContext* expressionContext, /// @brief function RANGE AqlValue Functions::Range(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "RANGE"; @@ -8453,7 +8451,7 @@ AqlValue Functions::Range(ExpressionContext* expressionContext, AstNode const&, /// @brief function POSITION AqlValue Functions::Position(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "POSITION"; @@ -8500,7 +8498,7 @@ AqlValue Functions::Position(ExpressionContext* expressionContext, /// @brief function CALL AqlValue Functions::Call(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "CALL"; AqlValue const& invokeFN = extractFunctionParameterValue(parameters, 0); @@ -8510,9 +8508,7 @@ AqlValue Functions::Call(ExpressionContext* expressionContext, return AqlValue(AqlValueHintNull()); } - ::arangodb::containers::SmallVector::allocator_type::arena_type - arena; - VPackFunctionParameters invokeParams{arena}; + VPackFunctionParameters invokeParams; if (parameters.size() >= 2) { // we have a list of parameters, need to copy them over except the // functionname: @@ -8530,7 +8526,7 @@ AqlValue Functions::Call(ExpressionContext* expressionContext, /// @brief function APPLY AqlValue Functions::Apply(ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "APPLY"; AqlValue const& invokeFN = extractFunctionParameterValue(parameters, 0); @@ -8540,9 +8536,7 @@ AqlValue Functions::Apply(ExpressionContext* expressionContext, return AqlValue(AqlValueHintNull()); } - ::arangodb::containers::SmallVector::allocator_type::arena_type - arena; - VPackFunctionParameters invokeParams{arena}; + VPackFunctionParameters invokeParams; AqlValue rawParamArray; std::vector mustFree; @@ -8581,14 +8575,14 @@ AqlValue Functions::Apply(ExpressionContext* expressionContext, /// @brief function VERSION AqlValue Functions::Version(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { return AqlValue(rest::Version::getServerVersion()); } /// @brief function IS_SAME_COLLECTION -AqlValue Functions::IsSameCollection( - ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { +AqlValue Functions::IsSameCollection(ExpressionContext* expressionContext, + AstNode const&, + VPackFunctionParametersView parameters) { static char const* AFN = "IS_SAME_COLLECTION"; auto* trx = &expressionContext->trx(); @@ -8606,7 +8600,7 @@ AqlValue Functions::IsSameCollection( AqlValue Functions::PregelResult(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { static char const* AFN = "PREGEL_RESULT"; AqlValue arg1 = extractFunctionParameterValue(parameters, 0); @@ -8657,7 +8651,7 @@ AqlValue Functions::PregelResult(ExpressionContext* expressionContext, } AqlValue Functions::Assert(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "ASSERT"; @@ -8676,7 +8670,7 @@ AqlValue Functions::Assert(ExpressionContext* expressionContext, AstNode const&, } AqlValue Functions::Warn(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "WARN"; @@ -8697,7 +8691,7 @@ AqlValue Functions::Warn(ExpressionContext* expressionContext, AstNode const&, } AqlValue Functions::Fail(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { if (parameters.size() == 0) { THROW_ARANGO_EXCEPTION_PARAMS(TRI_ERROR_QUERY_FAIL_CALLED, ""); } @@ -8718,7 +8712,7 @@ AqlValue Functions::Fail(ExpressionContext* expressionContext, AstNode const&, /// @brief function DATE_FORMAT AqlValue Functions::DateFormat(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& params) { + VPackFunctionParametersView params) { static char const* AFN = "DATE_FORMAT"; tp_sys_clock_ms tp; @@ -8738,7 +8732,7 @@ AqlValue Functions::DateFormat(ExpressionContext* expressionContext, AqlValue Functions::ShardId(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // Expecting 2 parameters // 0 : collection name or id // 1 : {shardKey1 : k1, shardKey2: k2, ..., shardKeyn: kn} @@ -8797,7 +8791,7 @@ AqlValue Functions::ShardId(ExpressionContext* expressionContext, /// @brief function DECODE_REV AqlValue Functions::DecodeRev(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto const rev = extractFunctionParameterValue(parameters, 0); if (!rev.isString()) { registerInvalidArgumentWarning(expressionContext, "DECODE_REV"); @@ -8843,7 +8837,7 @@ AqlValue Functions::DecodeRev(ExpressionContext* expressionContext, AqlValue Functions::SchemaGet(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); // SCHEMA_GET(collectionName) -> schema object std::string const collectionName = @@ -8885,7 +8879,7 @@ AqlValue Functions::SchemaGet(ExpressionContext* expressionContext, AqlValue Functions::SchemaValidate(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // SCHEMA_VALIDATE(doc, schema object) -> { valid (bool), [errorMessage // (string)] } static char const* AFN = "SCHEMA_VALIDATE"; @@ -8950,7 +8944,7 @@ AqlValue Functions::SchemaValidate(ExpressionContext* expressionContext, AqlValue Functions::Interleave( arangodb::aql::ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { // cppcheck-suppress variableScope static char const* AFN = "INTERLEAVE"; @@ -9005,7 +8999,7 @@ AqlValue Functions::Interleave( AqlValue Functions::CallGreenspun( arangodb::aql::ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods* trx = &expressionContext->trx(); greenspun::Machine m; greenspun::InitMachine(m); @@ -9069,7 +9063,7 @@ static AqlValue ConvertToObject(transaction::Methods& trx, VPackSlice input, AqlValue Functions::MakeDistributeInput( arangodb::aql::ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { AqlValue const& value = extractFunctionParameterValue(parameters, 0); VPackSlice const input = value.slice(); // will throw when wrong type @@ -9090,7 +9084,7 @@ AqlValue Functions::MakeDistributeInput( AqlValue Functions::MakeDistributeInputWithKeyCreation( arangodb::aql::ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods& trx = expressionContext->trx(); AqlValue value = extractFunctionParameterValue(parameters, 0); @@ -9176,7 +9170,7 @@ AqlValue Functions::MakeDistributeInputWithKeyCreation( AqlValue Functions::MakeDistributeGraphInput( arangodb::aql::ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { transaction::Methods& trx = expressionContext->trx(); AqlValue const& value = extractFunctionParameterValue(parameters, 0); VPackSlice input = value.slice(); // will throw when wrong type @@ -9237,7 +9231,7 @@ AqlValue Functions::MakeDistributeGraphInput( template AqlValue decayFuncImpl(arangodb::aql::ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters, + VPackFunctionParametersView parameters, F&& decayFuncFactory) { AqlValue const& argValue = extractFunctionParameterValue(parameters, 0); AqlValue const& originValue = extractFunctionParameterValue(parameters, 1); @@ -9315,7 +9309,7 @@ AqlValue decayFuncImpl(arangodb::aql::ExpressionContext* expressionContext, AqlValue Functions::DecayGauss( arangodb::aql::ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto gaussDecayFactory = [](const double origin, const double scale, const double offset, const double decay) { const double sigmaSqr = -(scale * scale) / (2 * std::log(decay)); @@ -9332,7 +9326,7 @@ AqlValue Functions::DecayGauss( AqlValue Functions::DecayExp( arangodb::aql::ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto expDecayFactory = [](const double origin, const double scale, const double offset, const double decay) { const double lambda = std::log(decay) / scale; @@ -9349,7 +9343,7 @@ AqlValue Functions::DecayExp( AqlValue Functions::DecayLinear( arangodb::aql::ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto linearDecayFactory = [](const double origin, const double scale, const double offset, const double decay) { const double s = scale / (1.0 - decay); @@ -9366,7 +9360,7 @@ AqlValue Functions::DecayLinear( template AqlValue DistanceImpl(arangodb::aql::ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters, + VPackFunctionParametersView parameters, F&& distanceFunc) { auto calculateDistance = [distanceFunc = std::forward(distanceFunc), expressionContext, @@ -9442,7 +9436,7 @@ AqlValue DistanceImpl(arangodb::aql::ExpressionContext* expressionContext, AqlValue Functions::CosineSimilarity( arangodb::aql::ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto cosineSimilarityFunc = [expressionContext, &node]( const VPackSlice lhs, const VPackSlice rhs, const VPackValueLength& length) { @@ -9483,7 +9477,7 @@ AqlValue Functions::CosineSimilarity( AqlValue Functions::L1Distance( arangodb::aql::ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto L1DistFunc = [expressionContext, &node](const VPackSlice lhs, const VPackSlice rhs, const VPackValueLength& length) { @@ -9510,7 +9504,7 @@ AqlValue Functions::L1Distance( AqlValue Functions::L2Distance( arangodb::aql::ExpressionContext* expressionContext, AstNode const& node, - VPackFunctionParameters const& parameters) { + VPackFunctionParametersView parameters) { auto L2DistFunc = [expressionContext, &node](const VPackSlice lhs, const VPackSlice rhs, const VPackValueLength& length) { @@ -9538,7 +9532,7 @@ AqlValue Functions::L2Distance( AqlValue Functions::NotImplemented(ExpressionContext* expressionContext, AstNode const&, - VPackFunctionParameters const& params) { + VPackFunctionParametersView params) { registerError(expressionContext, "UNKNOWN", TRI_ERROR_NOT_IMPLEMENTED); return AqlValue(AqlValueHintNull()); } diff --git a/arangod/Aql/Functions.h b/arangod/Aql/Functions.h index e500020e3634..e1e74c916ed5 100644 --- a/arangod/Aql/Functions.h +++ b/arangod/Aql/Functions.h @@ -25,10 +25,13 @@ #include "Aql/AqlValue.h" #include "Basics/ErrorCode.h" -#include "Containers/SmallVector.h" #include +#include "Containers/SmallVector.h" + +#include + namespace arangodb { class Result; namespace transaction { @@ -40,11 +43,12 @@ namespace aql { struct AstNode; class ExpressionContext; -typedef ::arangodb::containers::SmallVector VPackFunctionParameters; +using VPackFunctionParameters = containers::SmallVector; +using VPackFunctionParametersView = std::span; typedef AqlValue (*FunctionImplementation)(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); void registerError(ExpressionContext* expressionContext, char const* functionName, ErrorCode code); @@ -63,113 +67,111 @@ struct Functions { arangodb::velocypack::Slice const& slice); static AqlValue IsNull(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue IsBool(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue IsNumber(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue IsString(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue IsArray(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue IsObject(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Typename(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue ToNumber(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue ToString(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue ToBool(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue ToArray(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Length(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue FindFirst(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue FindLast(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Reverse(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue First(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Last(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Nth(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Contains(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Concat(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue ConcatSeparator(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue CharLength(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Lower(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Upper(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Substring(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Substitute(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Left(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Right(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Trim(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue LTrim(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue RTrim(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Split(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Like(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue RegexMatches(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue RegexTest(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue RegexReplace(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue RegexSplit(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue ToBase64(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue ToHex(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue EncodeURIComponent(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Uuid(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Soundex(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue LevenshteinDistance(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue LevenshteinMatch(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue NgramSimilarity(ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue NgramPositionalSimilarity(ExpressionContext* ctx, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue NgramMatch(ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue InRange(ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); // Date static AqlValue DateNow(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateIso8601(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateTimestamp(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); /** * @brief Tests is the first given parameter is a valid date string * format. @@ -184,55 +186,51 @@ struct Functions { */ static AqlValue IsDatestring(arangodb::aql::ExpressionContext* query, AstNode const&, - VPackFunctionParameters const& params); + VPackFunctionParametersView params); static AqlValue DateDayOfWeek(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue DateYear(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateMonth(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateDay(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateHour(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateMinute(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateSecond(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateMillisecond(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue DateDayOfYear(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue DateIsoWeek(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateLeapYear(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue DateQuarter(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateDaysInMonth(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue DateTrunc(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateUtcToLocal(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue DateLocalToUtc(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue DateTimeZone(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue DateTimeZones(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue DateAdd(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateSubtract(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue DateDiff(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DateRound(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); /** * @brief Compares two dates given as the first two arguments. * Third argument defines the highest signficant part, @@ -259,327 +257,313 @@ struct Functions { */ static AqlValue DateCompare(arangodb::aql::ExpressionContext* query, AstNode const&, - VPackFunctionParameters const& params); + VPackFunctionParametersView params); static AqlValue DateFormat(arangodb::aql::ExpressionContext* query, AstNode const&, - VPackFunctionParameters const& params); + VPackFunctionParametersView params); static AqlValue Passthru(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Unset(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue UnsetRecursive(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Keep(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue KeepRecursive(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Translate(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Merge(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue MergeRecursive(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Has(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Attributes(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Values(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Min(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Max(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Sum(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Average(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Product(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Sleep(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Collections(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue RandomToken(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue IpV4FromNumber(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue IpV4ToNumber(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue IsIpV4(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Md5(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Sha1(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Sha512(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Crc32(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Fnv64(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Hash(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue IsKey(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue CountDistinct(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue CheckDocument(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Unique(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue SortedUnique(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Sorted(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Union(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue UnionDistinct(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Intersection(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Outersection(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Jaccard(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Distance(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue GeoInRange(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue GeoDistance(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue GeoContains(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue GeoIntersects(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue GeoEquals(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue GeoArea(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue IsInPolygon(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue GeoPoint(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue GeoMultiPoint(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue GeoPolygon(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue GeoMultiPolygon(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue GeoLinestring(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue GeoMultiLinestring(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Flatten(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Zip(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue JsonStringify(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue JsonParse(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue ParseIdentifier(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Slice(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Minus(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Document(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Matches(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Round(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Abs(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Ceil(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Floor(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Sqrt(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Pow(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Log(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Log2(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Log10(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Exp(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Exp2(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Sin(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Cos(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Tan(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Asin(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Acos(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Atan(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Atan2(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Radians(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Degrees(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Pi(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue BitAnd(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue BitOr(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue BitXOr(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue BitNegate(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue BitTest(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue BitPopcount(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue BitShiftLeft(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue BitShiftRight(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue BitConstruct(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue BitDeconstruct(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue BitFromString(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue BitToString(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Rand(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue FirstDocument(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue FirstList(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Push(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Pop(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Append(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Unshift(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Shift(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue RemoveValue(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue RemoveValues(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue RemoveNth(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue ReplaceNth(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Interleave(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue NotNull(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue CurrentDatabase(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue CollectionCount(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue VarianceSample(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue PregelResult(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue VariancePopulation(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue StdDevSample(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue StdDevPopulation(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Median(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Percentile(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Range(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Position(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Call(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Apply(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Version(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue IsSameCollection(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue Assert(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Warn(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue Fail(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DecodeRev(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue ShardId(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue CurrentUser(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue SchemaGet(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue SchemaValidate(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue CallGreenspun(arangodb::aql::ExpressionContext*, - AstNode const&, VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue MakeDistributeInput(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue MakeDistributeInputWithKeyCreation( arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue MakeDistributeGraphInput(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DecayGauss(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DecayExp(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue DecayLinear(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue CosineSimilarity(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); static AqlValue L1Distance(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); static AqlValue L2Distance(arangodb::aql::ExpressionContext*, AstNode const&, - VPackFunctionParameters const&); + VPackFunctionParametersView); /// @brief dummy function that will only throw an error when called static AqlValue NotImplemented(arangodb::aql::ExpressionContext*, - AstNode const&, - VPackFunctionParameters const&); + AstNode const&, VPackFunctionParametersView); /// @brief maximum precision for bit operations static constexpr uint64_t bitFunctionsMaxSupportedBits = 32; diff --git a/arangod/Aql/IResearchViewOptimizerRules.cpp b/arangod/Aql/IResearchViewOptimizerRules.cpp index f36973db7e8f..d0bb1caa8e2b 100644 --- a/arangod/Aql/IResearchViewOptimizerRules.cpp +++ b/arangod/Aql/IResearchViewOptimizerRules.cpp @@ -441,9 +441,8 @@ bool optimizeSort(IResearchViewNode& viewNode, ExecutionPlan* plan) { } } -void keepReplacementViewVariables( - arangodb::containers::SmallVector const& calcNodes, - arangodb::containers::SmallVector const& viewNodes) { +void keepReplacementViewVariables(std::span calcNodes, + std::span viewNodes) { std::vector nodesToChange; std::vector>> usedColumnsCounter; @@ -508,7 +507,7 @@ void keepReplacementViewVariables( } bool noDocumentMaterialization( - arangodb::containers::SmallVector const& viewNodes, + std::span viewNodes, arangodb::containers::HashSet& toUnlink) { auto modified = false; VarSet currentUsedVars; @@ -601,9 +600,7 @@ void lateDocumentMaterializationArangoSearchRule( return; } - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + containers::SmallVector nodes; plan->findNodesOfType(nodes, ExecutionNode::LIMIT, true); for (auto* limitNode : nodes) { auto* loop = const_cast(limitNode->getLoop()); @@ -681,10 +678,7 @@ void lateDocumentMaterializationArangoSearchRule( *ExecutionNode::castTo(current); auto* subquery = subqueryNode.getSubquery(); TRI_ASSERT(subquery); - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type sa; - ::arangodb::containers::SmallVector - subqueryCalcNodes{sa}; + containers::SmallVector subqueryCalcNodes; // find calculation nodes in the plan of a subquery CalculationNodeVarFinder finder(&var, subqueryCalcNodes); valid = !subquery->walk(finder); @@ -796,9 +790,7 @@ void handleConstrainedSortInView(Optimizer* opt, return; } - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type va; - ::arangodb::containers::SmallVector viewNodes{va}; + containers::SmallVector viewNodes; plan->findNodesOfType(viewNodes, ExecutionNode::ENUMERATE_IRESEARCH_VIEW, true); for (auto* node : viewNodes) { @@ -837,9 +829,7 @@ void handleViewsRule(Optimizer* opt, std::unique_ptr plan, return; } - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type ca; - ::arangodb::containers::SmallVector calcNodes{ca}; + containers::SmallVector calcNodes; // replace scorers in all calculation nodes with references plan->findNodesOfType(calcNodes, ExecutionNode::CALCULATION, true); @@ -853,9 +843,7 @@ void handleViewsRule(Optimizer* opt, std::unique_ptr plan, } // register replaced scorers to be evaluated by corresponding view nodes - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type va; - ::arangodb::containers::SmallVector viewNodes{va}; + containers::SmallVector viewNodes; plan->findNodesOfType(viewNodes, ExecutionNode::ENUMERATE_IRESEARCH_VIEW, true); @@ -909,9 +897,7 @@ void scatterViewInClusterRule(Optimizer* opt, OptimizerRule const& rule) { TRI_ASSERT(arangodb::ServerState::instance()->isCoordinator()); bool wasModified = false; - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + containers::SmallVector nodes; // find subqueries std::unordered_map subqueries; diff --git a/arangod/Aql/IndexExecutor.cpp b/arangod/Aql/IndexExecutor.cpp index c06a16a3647e..2cb2d043843c 100644 --- a/arangod/Aql/IndexExecutor.cpp +++ b/arangod/Aql/IndexExecutor.cpp @@ -65,7 +65,7 @@ using namespace arangodb::aql; namespace { bool hasMultipleExpansions( - std::span const& indexes) noexcept { + std::span indexes) noexcept { // count how many attributes in the index are expanded (array index). // if more than a single attribute is expanded, we always need to // deduplicate the result later on. diff --git a/arangod/Aql/IndexNodeOptimizerRules.cpp b/arangod/Aql/IndexNodeOptimizerRules.cpp index 17178be1794e..e39db872667e 100644 --- a/arangod/Aql/IndexNodeOptimizerRules.cpp +++ b/arangod/Aql/IndexNodeOptimizerRules.cpp @@ -108,9 +108,7 @@ void arangodb::aql::lateDocumentMaterializationRule( return; } - arangodb::containers::SmallVector::allocator_type::arena_type - a; - arangodb::containers::SmallVector nodes{a}; + containers::SmallVector nodes; plan->findNodesOfType(nodes, ExecutionNode::LIMIT, true); for (auto* limitNode : nodes) { auto* loop = const_cast(limitNode->getLoop()); @@ -209,10 +207,7 @@ void arangodb::aql::lateDocumentMaterializationRule( *ExecutionNode::castTo(current); auto* subquery = subqueryNode.getSubquery(); TRI_ASSERT(subquery); - arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type sa; - arangodb::containers::SmallVector - subqueryCalcNodes{sa}; + containers::SmallVector subqueryCalcNodes; // find calculation nodes in the plan of a subquery CalculationNodeVarFinder finder(var, subqueryCalcNodes); valid = !subquery->walk(finder); diff --git a/arangod/Aql/NodeFinder.cpp b/arangod/Aql/NodeFinder.cpp index 568c36e97742..e9feb8c8511a 100644 --- a/arangod/Aql/NodeFinder.cpp +++ b/arangod/Aql/NodeFinder.cpp @@ -30,8 +30,7 @@ namespace aql { template<> NodeFinder::NodeFinder( ExecutionNode::NodeType const& lookingFor, - ::arangodb::containers::SmallVector& out, - bool enterSubqueries) + containers::SmallVector& out, bool enterSubqueries) : _out(out), _lookingFor(lookingFor), _enterSubqueries(enterSubqueries) {} /// @brief node finder for multiple types @@ -39,7 +38,7 @@ template<> NodeFinder, WalkerUniqueness::NonUnique>:: NodeFinder(std::initializer_list const& lookingFor, - ::arangodb::containers::SmallVector& out, + containers::SmallVector& out, bool enterSubqueries) : _out(out), _lookingFor(lookingFor), _enterSubqueries(enterSubqueries) {} @@ -74,7 +73,7 @@ template<> NodeFinder, WalkerUniqueness::Unique>:: NodeFinder(std::initializer_list const& lookingFor, - ::arangodb::containers::SmallVector& out, + containers::SmallVector& out, bool enterSubqueries) : _out(out), _lookingFor(lookingFor), _enterSubqueries(enterSubqueries) {} @@ -94,9 +93,8 @@ bool NodeFinder, } /// @brief node finder for one node type -EndNodeFinder::EndNodeFinder( - ::arangodb::containers::SmallVector& out, - bool enterSubqueries) +EndNodeFinder::EndNodeFinder(containers::SmallVector& out, + bool enterSubqueries) : _out(out), _found({false}), _enterSubqueries(enterSubqueries) {} /// @brief before method for one node type diff --git a/arangod/Aql/NodeFinder.h b/arangod/Aql/NodeFinder.h index 8834bcf5f953..4cd3e760bdb9 100644 --- a/arangod/Aql/NodeFinder.h +++ b/arangod/Aql/NodeFinder.h @@ -33,14 +33,14 @@ namespace aql { template class NodeFinder final : public WalkerWorker { - ::arangodb::containers::SmallVector& _out; + containers::SmallVector& _out; T _lookingFor; bool _enterSubqueries; public: - NodeFinder(T const&, ::arangodb::containers::SmallVector&, + NodeFinder(T const&, containers::SmallVector&, bool enterSubqueries); bool before(ExecutionNode*) override final; @@ -52,14 +52,14 @@ class NodeFinder final : public WalkerWorker { class EndNodeFinder final : public WalkerWorker { - ::arangodb::containers::SmallVector& _out; + containers::SmallVector& _out; std::vector _found; bool _enterSubqueries; public: - EndNodeFinder(::arangodb::containers::SmallVector&, + EndNodeFinder(containers::SmallVector&, bool enterSubqueries); bool before(ExecutionNode*) override final; diff --git a/arangod/Aql/OptimizerRules.cpp b/arangod/Aql/OptimizerRules.cpp index 2448cc80b088..d8daf3f65811 100644 --- a/arangod/Aql/OptimizerRules.cpp +++ b/arangod/Aql/OptimizerRules.cpp @@ -1015,8 +1015,7 @@ Collection* addCollectionToQuery(QueryContext& query, std::string const& cname, void arangodb::aql::sortInValuesRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::FILTER, true); bool modified = false; @@ -1207,8 +1206,7 @@ void arangodb::aql::sortInValuesRule(Optimizer* opt, void arangodb::aql::removeRedundantSortsRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::SORT, true); if (nodes.empty()) { @@ -1357,8 +1355,7 @@ void arangodb::aql::removeRedundantSortsRule( void arangodb::aql::removeUnnecessaryFiltersRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::FILTER, true); bool modified = false; @@ -1409,8 +1406,7 @@ void arangodb::aql::removeUnnecessaryFiltersRule( void arangodb::aql::removeCollectVariablesRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::COLLECT, true); bool modified = false; @@ -1542,8 +1538,7 @@ class PropagateConstantAttributesHelper { /// @brief inspects a plan and propagates constant values in expressions void propagateConstants() { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; _plan->findNodesOfType(nodes, EN::FILTER, true); for (auto const& node : nodes) { @@ -1790,8 +1785,7 @@ void arangodb::aql::propagateConstantAttributesRule( void arangodb::aql::moveCalculationsUpRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::CALCULATION, true); plan->findNodesOfType(nodes, EN::SUBQUERY, true); @@ -1799,8 +1793,7 @@ void arangodb::aql::moveCalculationsUpRule(Optimizer* opt, subqueriesArena; SmallUnorderedMap subqueries{subqueriesArena}; { - ::arangodb::containers::SmallVectorWithArena subsStorage; - auto& subs = subsStorage.vector(); + containers::SmallVector subs; plan->findNodesOfType(subs, ExecutionNode::SUBQUERY, true); // we build a map of the top-most nodes of each subquery to the outer @@ -1921,8 +1914,7 @@ void arangodb::aql::moveCalculationsUpRule(Optimizer* opt, void arangodb::aql::moveCalculationsDownRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, {EN::CALCULATION, EN::SUBQUERY}, true); std::vector stack; @@ -2040,8 +2032,7 @@ void arangodb::aql::moveCalculationsDownRule( void arangodb::aql::specializeCollectRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::COLLECT, true); bool modified = false; @@ -2190,8 +2181,7 @@ void arangodb::aql::specializeCollectRule(Optimizer* opt, void arangodb::aql::moveFiltersUpRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::FILTER, true); std::vector stack; @@ -2289,8 +2279,7 @@ struct VariableReplacer final void arangodb::aql::simplifyConditionsRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::CALCULATION, true); if (nodes.empty()) { @@ -2519,8 +2508,7 @@ void arangodb::aql::simplifyConditionsRule(Optimizer* opt, void arangodb::aql::fuseFiltersRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::FILTER, true); if (nodes.size() < 2) { @@ -2612,8 +2600,7 @@ void arangodb::aql::fuseFiltersRule(Optimizer* opt, void arangodb::aql::removeRedundantCalculationsRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::CALCULATION, true); if (nodes.size() < 2) { @@ -2734,8 +2721,7 @@ void arangodb::aql::removeRedundantCalculationsRule( void arangodb::aql::removeUnnecessaryCalculationsRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, ::removeUnnecessaryCalculationsNodeTypes, true); ::arangodb::containers::HashSet toUnlink; @@ -2940,8 +2926,7 @@ void arangodb::aql::useIndexesRule(Optimizer* opt, OptimizerRule const& rule) { // These are all the nodes where we start traversing (including all // subqueries) - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findEndNodes(nodes, true); std::unordered_map changes; @@ -3393,8 +3378,7 @@ struct SortToIndexNode final void arangodb::aql::useIndexForSortRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::SORT, true); bool modified = false; @@ -3417,8 +3401,7 @@ void arangodb::aql::useIndexForSortRule(Optimizer* opt, void arangodb::aql::removeFiltersCoveredByIndexRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::FILTER, true); ::arangodb::containers::HashSet toUnlink; @@ -3565,8 +3548,7 @@ static bool NextPermutationTuple(std::vector& data, void arangodb::aql::interchangeAdjacentEnumerationsRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, ::interchangeAdjacentEnumerationsNodeTypes, true); @@ -3932,8 +3914,7 @@ void moveScatterAbove(ExecutionPlan& plan, ExecutionNode* at) { void arangodb::aql::findSubqueriesInPlan( ExecutionPlan& plan, SmallUnorderedMap& subqueries) { - ::arangodb::containers::SmallVectorWithArena subsStorage; - auto& subs = subsStorage.vector(); + containers::SmallVector subs; plan.findNodesOfType(subs, ExecutionNode::SUBQUERY, true); for (auto& it : subs) { @@ -3962,8 +3943,7 @@ void arangodb::aql::scatterInClusterRule(Optimizer* opt, // we are a coordinator. now look in the plan for nodes of type // EnumerateCollectionNode, IndexNode, IResearchViewNode, and modification // nodes - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, ::scatterInClusterNodeTypes, true); TRI_ASSERT(plan->getAst()); @@ -4276,9 +4256,7 @@ void arangodb::aql::distributeInClusterRule(Optimizer* opt, // we are a coordinator, we replace the root if it is a modification node // only replace if it is the last node in the plan - ::arangodb::containers::SmallVectorWithArena - subqueryNodesStorage; - auto& subqueryNodes = subqueryNodesStorage.vector(); + containers::SmallVector subqueryNodes; // inspect each return node and work upwards to SingletonNode subqueryNodes.push_back(plan->root()); plan->findNodesOfType(subqueryNodes, ExecutionNode::SUBQUERY, true); @@ -4385,8 +4363,7 @@ void arangodb::aql::collectInClusterRule(Optimizer* opt, TRI_ASSERT(arangodb::ServerState::instance()->isCoordinator()); bool wasModified = false; - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::COLLECT, true); VarSet allUsed; @@ -4696,8 +4673,7 @@ void arangodb::aql::distributeFilterCalcToClusterRule( OptimizerRule const& rule) { bool modified = false; - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::GATHER, true); VarSet varsSetHere; @@ -4836,8 +4812,7 @@ void arangodb::aql::distributeFilterCalcToClusterRule( void arangodb::aql::distributeSortToClusterRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; VarSet usedBySort; plan->findNodesOfType(nodes, EN::GATHER, true); @@ -4970,8 +4945,7 @@ void arangodb::aql::distributeSortToClusterRule( void arangodb::aql::removeUnnecessaryRemoteScatterRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::REMOTE, true); ::arangodb::containers::HashSet toUnlink; @@ -5057,8 +5031,7 @@ void arangodb::aql::restrictToSingleShardRule( return; } - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::REMOTE, true); ::arangodb::containers::HashSet toUnlink; @@ -5475,8 +5448,7 @@ class RemoveToEnumCollFinder final void arangodb::aql::undistributeRemoveAfterEnumCollRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, ::undistributeNodeTypes, true); ::arangodb::containers::HashSet toUnlink; @@ -5795,8 +5767,7 @@ struct OrSimplifier { void arangodb::aql::replaceOrWithInRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::FILTER, true); bool modified = false; @@ -5974,8 +5945,7 @@ struct RemoveRedundantOr { void arangodb::aql::removeRedundantOrRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::FILTER, true); bool modified = false; @@ -6022,8 +5992,7 @@ void arangodb::aql::removeDataModificationOutVariablesRule( OptimizerRule const& rule) { bool modified = false; - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, ::removeDataModificationOutVariablesNodeTypes, true); @@ -6099,8 +6068,7 @@ void arangodb::aql::removeDataModificationOutVariablesRule( void arangodb::aql::optimizeTraversalsRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena tNodesStorage; - auto& tNodes = tNodesStorage.vector(); + containers::SmallVector tNodes; plan->findNodesOfType(tNodes, EN::TRAVERSAL, true); if (tNodes.empty()) { @@ -6187,8 +6155,7 @@ void arangodb::aql::optimizeTraversalsRule(Optimizer* opt, if (!tNodes.empty()) { // These are all the end nodes where we start - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findEndNodes(nodes, true); for (auto const& n : nodes) { @@ -6204,8 +6171,7 @@ void arangodb::aql::optimizeTraversalsRule(Optimizer* opt, void arangodb::aql::removeFiltersCoveredByTraversal( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena fNodesStorage; - auto& fNodes = fNodesStorage.vector(); + containers::SmallVector fNodes; plan->findNodesOfType(fNodes, EN::FILTER, true); if (fNodes.empty()) { // no filters present @@ -6315,8 +6281,7 @@ void arangodb::aql::removeFiltersCoveredByTraversal( void arangodb::aql::removeTraversalPathVariable( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena tNodesStorage; - auto& tNodes = tNodesStorage.vector(); + containers::SmallVector tNodes; plan->findNodesOfType(tNodes, EN::TRAVERSAL, true); bool modified = false; @@ -6353,8 +6318,7 @@ void arangodb::aql::removeTraversalPathVariable( void arangodb::aql::inlineSubqueriesRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::SUBQUERY, true); if (nodes.empty()) { @@ -7222,8 +7186,7 @@ static bool applyGeoOptimization(ExecutionPlan* plan, LimitNode* ln, void arangodb::aql::geoIndexRule(Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; bool mod = false; plan->findNodesOfType(nodes, EN::ENUMERATE_COLLECTION, true); @@ -7350,9 +7313,7 @@ void arangodb::aql::sortLimitRule(Optimizer* opt, return; } - ::arangodb::containers::SmallVectorWithArena - limitNodesStorage; - auto& limitNodes = limitNodesStorage.vector(); + containers::SmallVector limitNodes; plan->findNodesOfType(limitNodes, EN::LIMIT, true); for (ExecutionNode* node : limitNodes) { @@ -7431,8 +7392,7 @@ void arangodb::aql::optimizeSubqueriesRule(Optimizer* opt, OptimizerRule const& rule) { bool modified = false; - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::CALCULATION, true); // value type is {limit value, referenced by, used for counting} @@ -7631,8 +7591,7 @@ void arangodb::aql::moveFiltersIntoEnumerateRule( OptimizerRule const& rule) { bool modified = false; - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, ::moveFilterIntoEnumerateTypes, true); VarSet found; @@ -7836,8 +7795,7 @@ void arangodb::aql::optimizeCountRule(Optimizer* opt, return; } - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::CALCULATION, true); VarSet vars; @@ -8156,8 +8114,7 @@ void arangodb::aql::parallelizeGatherRule(Optimizer* opt, // the only case in which we currently can employ parallelization is when // there is only a single GatherNode. all other restrictions for // parallelization (e.g. no DistributeNodes around) still apply. - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::GATHER, true); if (nodes.size() == 1 && !plan->contains(EN::DISTRIBUTE) && @@ -8272,12 +8229,10 @@ void arangodb::aql::activateCallstackSplit(ExecutionPlan& plan) { namespace { void findSubqueriesSuitableForSplicing( - ExecutionPlan const& plan, containers::SmallVector& result) { + ExecutionPlan const& plan, + containers::SmallVector& result) { TRI_ASSERT(result.empty()); using ResultVector = decltype(result); - using BoolVec = - std::vector>; using SuitableNodeSet = std::set, @@ -8308,50 +8263,25 @@ void findSubqueriesSuitableForSplicing( : public WalkerWorker { public: explicit Finder(ResultVector& result, SuitableNodeSet& suitableNodes) - : _result{result}, - _suitableNodes{suitableNodes}, - _isSuitableArena{}, - _isSuitableLevel{BoolVec{_isSuitableArena}} { - // push the top-level query - _isSuitableLevel.emplace(true); - } + : _result{result}, _suitableNodes{suitableNodes} {} - bool before(ExecutionNode* node) override final { + bool before(ExecutionNode* node) final { TRI_ASSERT(node->getType() != EN::MUTEX); // should never appear here - if (node->getType() == ExecutionNode::SUBQUERY) { _result.emplace_back(ExecutionNode::castTo(node)); } - - // We could set - // _isSuitable.top() = true; - // here when we encounter nodes that never pass skipping through, like - // SORT, enabling a few more possibilities where to enable this rule. - - constexpr bool abort = false; - return abort; + return false; } - bool enterSubquery(ExecutionNode* subq, - ExecutionNode* root) override final { - _isSuitableLevel.emplace(true); - - constexpr bool enterSubqueries = true; - return enterSubqueries; + bool enterSubquery(ExecutionNode*, ExecutionNode*) final { + ++_isSuitableLevel; + return true; } - void leaveSubquery(ExecutionNode* subqueryNode, - ExecutionNode*) override final { - TRI_ASSERT(!_isSuitableLevel.empty()); - - const bool subqueryDoesNotSkipInside = _isSuitableLevel.top(); - _isSuitableLevel.pop(); - const bool containingSubqueryDoesNotSkip = _isSuitableLevel.top(); - - if (subqueryDoesNotSkipInside && containingSubqueryDoesNotSkip) { - _suitableNodes.emplace( - ExecutionNode::castTo(subqueryNode)); - } + void leaveSubquery(ExecutionNode* subQuery, ExecutionNode*) final { + TRI_ASSERT(_isSuitableLevel != 0); + --_isSuitableLevel; + _suitableNodes.emplace(ExecutionNode::castTo(subQuery)); } private: @@ -8359,14 +8289,7 @@ void findSubqueriesSuitableForSplicing( ResultVector& _result; // only suitable subquery nodes will be added to this set SuitableNodeSet& _suitableNodes; - - using BoolArena = BoolVec::allocator_type::arena_type; - using BoolStack = std::stack; - - BoolArena _isSuitableArena; - // _isSuitable.top() says whether there is a node that skips in the - // current (sub)query level. - BoolStack _isSuitableLevel; + size_t _isSuitableLevel{1}; // push the top-level query }; using SuitableNodeArena = SuitableNodeSet::allocator_type::arena_type; @@ -8407,9 +8330,7 @@ void arangodb::aql::spliceSubqueriesRule(Optimizer* opt, OptimizerRule const& rule) { bool modified = false; - ::arangodb::containers::SmallVectorWithArena - subqueryNodesStorage; - auto& subqueryNodes = subqueryNodesStorage.vector(); + containers::SmallVector subqueryNodes; findSubqueriesSuitableForSplicing(*plan, subqueryNodes); // Note that we rely on the order `subqueryNodes` in the sense that, for @@ -8537,8 +8458,7 @@ void arangodb::aql::spliceSubqueriesRule(Optimizer* opt, void arangodb::aql::decayUnnecessarySortedGather( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::GATHER, true); bool modified = false; @@ -8564,8 +8484,7 @@ void arangodb::aql::decayUnnecessarySortedGather( } void arangodb::aql::insertDistributeInputCalculation(ExecutionPlan& plan) { - ::arangodb::containers::SmallVectorWithArena nodesStorage; - auto& nodes = nodesStorage.vector(); + containers::SmallVector nodes; plan.findNodesOfType(nodes, ExecutionNode::DISTRIBUTE, true); for (auto const& n : nodes) { diff --git a/arangod/Aql/OptimizerRulesCluster.cpp b/arangod/Aql/OptimizerRulesCluster.cpp index 19b82b95820a..c9d1101300ff 100644 --- a/arangod/Aql/OptimizerRulesCluster.cpp +++ b/arangod/Aql/OptimizerRulesCluster.cpp @@ -191,9 +191,7 @@ void replaceNode(ExecutionPlan* plan, ExecutionNode* oldNode, bool substituteClusterSingleDocumentOperationsIndex(Optimizer* opt, ExecutionPlan* plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::INDEX, false); if (nodes.size() != 1) { @@ -297,9 +295,7 @@ bool substituteClusterSingleDocumentOperationsIndex(Optimizer* opt, bool substituteClusterSingleDocumentOperationsNoIndex( Optimizer* opt, ExecutionPlan* plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + containers::SmallVector nodes; plan->findNodesOfType( nodes, {EN::INSERT, EN::REMOVE, EN::UPDATE, EN::REPLACE}, false); diff --git a/arangod/Aql/OptimizerRulesReplaceFunctions.cpp b/arangod/Aql/OptimizerRulesReplaceFunctions.cpp index b474ade4c8ac..0944c93cbf55 100644 --- a/arangod/Aql/OptimizerRulesReplaceFunctions.cpp +++ b/arangod/Aql/OptimizerRulesReplaceFunctions.cpp @@ -573,9 +573,7 @@ void arangodb::aql::replaceNearWithinFulltextRule( OptimizerRule const& rule) { bool modified = false; - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + containers::SmallVector nodes; plan->findNodesOfType(nodes, ExecutionNode::CALCULATION, true); for (auto const& node : nodes) { diff --git a/arangod/Aql/OptimizerUtils.cpp b/arangod/Aql/OptimizerUtils.cpp index cc4b902c7cbc..ca9cbf8b3c7d 100644 --- a/arangod/Aql/OptimizerUtils.cpp +++ b/arangod/Aql/OptimizerUtils.cpp @@ -63,9 +63,7 @@ bool sortOrs(arangodb::aql::Ast* ast, arangodb::aql::AstNode* root, typedef std::pair> ConditionData; - ::arangodb::containers::SmallVector< - ConditionData*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector conditionData{a}; + containers::SmallVector conditionData; auto sg = arangodb::scopeGuard([&conditionData]() noexcept -> void { for (auto& it : conditionData) { diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index 0048fc97d004..9855ea175891 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -1593,9 +1593,7 @@ aql::ExecutionState Query::cleanupTrxAndEngines(ErrorCode errorCode) { } void Query::injectVertexCollectionIntoGraphNodes(ExecutionPlan& plan) { - ::arangodb::containers::SmallVectorWithArena - graphNodesStorage; - auto& graphNodes = graphNodesStorage.vector(); + containers::SmallVector graphNodes; plan.findNodesOfType(graphNodes, {ExecutionNode::TRAVERSAL, ExecutionNode::SHORTEST_PATH, diff --git a/arangod/Aql/QueryList.cpp b/arangod/Aql/QueryList.cpp index 4927893d06a2..56cbf45a9093 100644 --- a/arangod/Aql/QueryList.cpp +++ b/arangod/Aql/QueryList.cpp @@ -44,7 +44,7 @@ #include #include -#include +#include "Containers/SmallVector.h" using namespace arangodb; using namespace arangodb::aql; @@ -291,7 +291,7 @@ uint64_t QueryList::kill(std::function const& filter, // We must not call the std::shared_ptr dtor under the `_lock`, // because this can result in a deadlock since the Query dtor tries to // remove itself from this list which acquires the write `_lock` - absl::InlinedVector, 16> queries; + containers::SmallVector, 16> queries; { READ_LOCKER(readLocker, _lock); queries.reserve(_current.size()); @@ -317,7 +317,7 @@ std::vector QueryList::listCurrent() { // We must not call the std::shared_ptr dtor under the `_lock`, // because this can result in a deadlock since the Query dtor tries to // remove itself from this list which acquires the write `_lock` - absl::InlinedVector, 16> queries; + containers::SmallVector, 16> queries; std::vector result; // reserve room for some queries outside of the lock already, // so we reduce the possibility of having to reserve more room later diff --git a/arangod/IResearch/IResearchAnalyzerFeature.cpp b/arangod/IResearch/IResearchAnalyzerFeature.cpp index 6003e871374e..be6e4b24c2b0 100644 --- a/arangod/IResearch/IResearchAnalyzerFeature.cpp +++ b/arangod/IResearch/IResearchAnalyzerFeature.cpp @@ -143,7 +143,7 @@ bool normalize(std::string& out, irs::string_ref type, aql::AqlValue aqlFnTokens(aql::ExpressionContext* expressionContext, aql::AstNode const&, - aql::VPackFunctionParameters const& args) { + aql::VPackFunctionParametersView args) { if (ADB_UNLIKELY(args.empty() || args.size() > 2)) { irs::string_ref const message = "invalid arguments count while computing result for function 'TOKENS'"; diff --git a/arangod/IResearch/IResearchAqlAnalyzer.cpp b/arangod/IResearch/IResearchAqlAnalyzer.cpp index b535278a011c..eb0bee31dc67 100644 --- a/arangod/IResearch/IResearchAqlAnalyzer.cpp +++ b/arangod/IResearch/IResearchAqlAnalyzer.cpp @@ -356,7 +356,7 @@ bool AqlAnalyzer::next() { std::get<2>(_attrs).value = arangodb::iresearch::getBytesRef(value.slice()); } else { - VPackFunctionParameters params{_params_arena}; + VPackFunctionParameters params; params.push_back(value); aql::NoVarExpressionContext ctx(_query->trxForOptimization(), *_query, @@ -372,7 +372,7 @@ bool AqlAnalyzer::next() { if (value.isNumber()) { std::get<3>(_attrs).value = value.slice(); } else { - VPackFunctionParameters params{_params_arena}; + VPackFunctionParameters params; params.push_back(value); aql::NoVarExpressionContext ctx(_query->trxForOptimization(), *_query, @@ -387,7 +387,7 @@ bool AqlAnalyzer::next() { if (value.isBoolean()) { std::get<3>(_attrs).value = value.slice(); } else { - VPackFunctionParameters params{_params_arena}; + VPackFunctionParameters params; params.push_back(value); aql::NoVarExpressionContext ctx(_query->trxForOptimization(), *_query, diff --git a/arangod/IResearch/IResearchAqlAnalyzer.h b/arangod/IResearch/IResearchAqlAnalyzer.h index e899ad41c967..356c053601f7 100644 --- a/arangod/IResearch/IResearchAqlAnalyzer.h +++ b/arangod/IResearch/IResearchAqlAnalyzer.h @@ -120,8 +120,6 @@ class AqlAnalyzer final : public irs::analysis::analyzer { Options _options; aql::AqlValue _valueBuffer; std::unique_ptr _query; - containers::SmallVector::allocator_type::arena_type - _params_arena; aql::AqlFunctionsInternalCache _aqlFunctionsInternalCache; aql::AqlItemBlockManager _itemBlockManager; aql::ExecutionEngine _engine; diff --git a/arangod/IResearch/IResearchFeature.cpp b/arangod/IResearch/IResearchFeature.cpp index b984695a68e6..03a8b6e3e589 100644 --- a/arangod/IResearch/IResearchFeature.cpp +++ b/arangod/IResearch/IResearchFeature.cpp @@ -96,7 +96,7 @@ using namespace arangodb; using namespace arangodb::iresearch; aql::AqlValue dummyFilterFunc(aql::ExpressionContext*, aql::AstNode const&, - containers::SmallVector const&) { + std::span) { THROW_ARANGO_EXCEPTION_MESSAGE( TRI_ERROR_NOT_IMPLEMENTED, "ArangoSearch filter functions EXISTS, PHRASE " @@ -109,7 +109,7 @@ aql::AqlValue dummyFilterFunc(aql::ExpressionContext*, aql::AstNode const&, // Just returns its first argument as outside ArangoSearch context // there is nothing to do with search stuff, but optimization could roll. aql::AqlValue contextFunc(aql::ExpressionContext* ctx, aql::AstNode const&, - containers::SmallVector const& args) { + std::span args) { TRI_ASSERT(ctx); TRI_ASSERT(!args.empty()); // ensured by function signature @@ -127,9 +127,8 @@ inline aql::AqlValue errorAqlValue(aql::ExpressionContext* ctx, // Executes STARTS_WITH function with const parameters locally the same way // it will be done in ArangoSearch at runtime // This will allow optimize out STARTS_WITH call if all arguments are const -aql::AqlValue startsWithFunc( - aql::ExpressionContext* ctx, aql::AstNode const&, - containers::SmallVector const& args) { +aql::AqlValue startsWithFunc(aql::ExpressionContext* ctx, aql::AstNode const&, + std::span args) { static char const* AFN = "STARTS_WITH"; auto const argc = args.size(); @@ -188,7 +187,7 @@ aql::AqlValue startsWithFunc( /// it will be done in ArangoSearch at runtime /// This will allow optimize out MIN_MATCH call if all arguments are const aql::AqlValue minMatchFunc(aql::ExpressionContext* ctx, aql::AstNode const&, - containers::SmallVector const& args) { + std::span args) { static char const* AFN = "MIN_MATCH"; TRI_ASSERT(args.size() > 1); // ensured by function signature @@ -210,7 +209,7 @@ aql::AqlValue minMatchFunc(aql::ExpressionContext* ctx, aql::AstNode const&, } aql::AqlValue dummyScorerFunc(aql::ExpressionContext*, aql::AstNode const&, - containers::SmallVector const&) { + std::span) { THROW_ARANGO_EXCEPTION_MESSAGE( TRI_ERROR_NOT_IMPLEMENTED, "ArangoSearch scorer functions BM25() and TFIDF() are designed to " diff --git a/arangod/Network/ConnectionPool.h b/arangod/Network/ConnectionPool.h index a5c3b0180a0b..6d23293c4b4b 100644 --- a/arangod/Network/ConnectionPool.h +++ b/arangod/Network/ConnectionPool.h @@ -121,9 +121,7 @@ class ConnectionPool final { // uint64_t bytesSend; // uint64_t bytesReceived; // uint64_t numRequests; - containers::SmallVector< - std::shared_ptr>::allocator_type::arena_type arena; - containers::SmallVector> list{arena}; + containers::SmallVector, 4> list; }; TEST_VIRTUAL std::shared_ptr createConnection( diff --git a/arangod/RocksDBEngine/RocksDBOptimizerRules.cpp b/arangod/RocksDBEngine/RocksDBOptimizerRules.cpp index 338aefa63c1c..08af5fdd15d1 100644 --- a/arangod/RocksDBEngine/RocksDBOptimizerRules.cpp +++ b/arangod/RocksDBEngine/RocksDBOptimizerRules.cpp @@ -78,9 +78,7 @@ void RocksDBOptimizerRules::reduceExtractionToProjectionRule( OptimizerRule const& rule) { // These are all the nodes where we start traversing (including all // subqueries) - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + containers::SmallVector nodes; plan->findNodesOfType(nodes, ::reduceExtractionToProjectionTypes, true); @@ -440,9 +438,7 @@ void RocksDBOptimizerRules::reduceExtractionToProjectionRule( void RocksDBOptimizerRules::removeSortRandRule( Optimizer* opt, std::unique_ptr plan, OptimizerRule const& rule) { - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + containers::SmallVector nodes; plan->findNodesOfType(nodes, EN::SORT, true); bool modified = false; diff --git a/arangod/RocksDBEngine/RocksDBVPackIndex.cpp b/arangod/RocksDBEngine/RocksDBVPackIndex.cpp index ef2fe3ff61a0..442e72b61583 100644 --- a/arangod/RocksDBEngine/RocksDBVPackIndex.cpp +++ b/arangod/RocksDBEngine/RocksDBVPackIndex.cpp @@ -1096,8 +1096,8 @@ void RocksDBVPackIndex::toVelocyPack( /// uses the _unique field to determine the kind of key structure ErrorCode RocksDBVPackIndex::fillElement( VPackBuilder& leased, LocalDocumentId const& documentId, VPackSlice doc, - ::arangodb::containers::SmallVector& elements, - ::arangodb::containers::SmallVector& hashes) { + containers::SmallVector& elements, + containers::SmallVector& hashes) { if (doc.isNone()) { LOG_TOPIC("51c6c", ERR, arangodb::Logger::ENGINES) << "encountered invalid marker with slice of type None"; @@ -1155,9 +1155,7 @@ ErrorCode RocksDBVPackIndex::fillElement( } else { // other path for handling array elements, too - ::arangodb::containers::SmallVector::allocator_type::arena_type - sliceStackArena; - ::arangodb::containers::SmallVector sliceStack{sliceStackArena}; + containers::SmallVector sliceStack; try { buildIndexValues(leased, documentId, doc, 0, elements, hashes, @@ -1177,10 +1175,9 @@ ErrorCode RocksDBVPackIndex::fillElement( void RocksDBVPackIndex::addIndexValue( VPackBuilder& leased, LocalDocumentId const& documentId, - VPackSlice document, - ::arangodb::containers::SmallVector& elements, - ::arangodb::containers::SmallVector& hashes, - ::arangodb::containers::SmallVector& sliceStack) { + VPackSlice document, containers::SmallVector& elements, + containers::SmallVector& hashes, + std::span sliceStack) { leased.clear(); leased.openArray(true); // unindexed for (VPackSlice const& s : sliceStack) { @@ -1211,9 +1208,9 @@ void RocksDBVPackIndex::addIndexValue( void RocksDBVPackIndex::buildIndexValues( VPackBuilder& leased, LocalDocumentId const& documentId, VPackSlice const doc, size_t level, - ::arangodb::containers::SmallVector& elements, - ::arangodb::containers::SmallVector& hashes, - ::arangodb::containers::SmallVector& sliceStack) { + containers::SmallVector& elements, + containers::SmallVector& hashes, + containers::SmallVector& sliceStack) { // Invariant: level == sliceStack.size() // Stop the recursion: @@ -1384,12 +1381,8 @@ Result RocksDBVPackIndex::checkOperation(transaction::Methods& trx, IndexOperationMode mode = options.indexOperationMode; rocksdb::Status s; - ::arangodb::containers::SmallVector::allocator_type::arena_type - elementsArena; - ::arangodb::containers::SmallVector elements{elementsArena}; - ::arangodb::containers::SmallVector::allocator_type::arena_type - hashesArena; - ::arangodb::containers::SmallVector hashes{hashesArena}; + containers::SmallVector elements; + containers::SmallVector hashes; { // rethrow all types of exceptions from here... @@ -1466,12 +1459,8 @@ Result RocksDBVPackIndex::insert(transaction::Methods& trx, OperationOptions const& options, bool performChecks) { Result res; - ::arangodb::containers::SmallVector::allocator_type::arena_type - elementsArena; - ::arangodb::containers::SmallVector elements{elementsArena}; - ::arangodb::containers::SmallVector::allocator_type::arena_type - hashesArena; - ::arangodb::containers::SmallVector hashes{hashesArena}; + containers::SmallVector elements; + containers::SmallVector hashes; { // rethrow all types of exceptions from here... @@ -1699,12 +1688,8 @@ Result RocksDBVPackIndex::update( // update-in-place following... Result res; - ::arangodb::containers::SmallVector::allocator_type::arena_type - elementsArena; - ::arangodb::containers::SmallVector elements{elementsArena}; - ::arangodb::containers::SmallVector::allocator_type::arena_type - hashesArena; - ::arangodb::containers::SmallVector hashes{hashesArena}; + containers::SmallVector elements; + containers::SmallVector hashes; { // rethrow all types of exceptions from here... transaction::BuilderLeaser leased(&trx); @@ -1746,12 +1731,8 @@ Result RocksDBVPackIndex::remove(transaction::Methods& trx, } Result res; rocksdb::Status s; - ::arangodb::containers::SmallVector::allocator_type::arena_type - elementsArena; - ::arangodb::containers::SmallVector elements{elementsArena}; - ::arangodb::containers::SmallVector::allocator_type::arena_type - hashesArena; - ::arangodb::containers::SmallVector hashes{hashesArena}; + containers::SmallVector elements; + containers::SmallVector hashes; { // rethrow all types of exceptions from here... diff --git a/arangod/RocksDBEngine/RocksDBVPackIndex.h b/arangod/RocksDBEngine/RocksDBVPackIndex.h index 9f12a9f638cd..27c4f1f78d03 100644 --- a/arangod/RocksDBEngine/RocksDBVPackIndex.h +++ b/arangod/RocksDBEngine/RocksDBVPackIndex.h @@ -44,6 +44,8 @@ #include "VocBase/voc-types.h" #include "VocBase/vocbase.h" +#include + namespace arangodb { namespace aql { class SortCondition; @@ -197,32 +199,31 @@ class RocksDBVPackIndex : public RocksDBIndex { std::vector* expanding); /// @brief helper function to insert a document into any index type - ErrorCode fillElement( - velocypack::Builder& leased, LocalDocumentId const& documentId, - VPackSlice doc, ::arangodb::containers::SmallVector& elements, - ::arangodb::containers::SmallVector& hashes); + ErrorCode fillElement(velocypack::Builder& leased, + LocalDocumentId const& documentId, VPackSlice doc, + containers::SmallVector& elements, + containers::SmallVector& hashes); /// @brief helper function to build the key and value for rocksdb from the /// vector of slices /// @param hashes list of VPackSlice hashes for the estimator. - void addIndexValue( - velocypack::Builder& leased, LocalDocumentId const& documentId, - VPackSlice document, - ::arangodb::containers::SmallVector& elements, - ::arangodb::containers::SmallVector& hashes, - ::arangodb::containers::SmallVector& sliceStack); + void addIndexValue(velocypack::Builder& leased, + LocalDocumentId const& documentId, VPackSlice document, + containers::SmallVector& elements, + containers::SmallVector& hashes, + std::span sliceStack); /// @brief helper function to create a set of value combinations to insert /// into the rocksdb index. /// @param elements vector of resulting index entries /// @param sliceStack working list of values to insert into the index /// @param hashes list of VPackSlice hashes for the estimator. - void buildIndexValues( - velocypack::Builder& leased, LocalDocumentId const& documentId, - VPackSlice const document, size_t level, - ::arangodb::containers::SmallVector& elements, - ::arangodb::containers::SmallVector& hashes, - ::arangodb::containers::SmallVector& sliceStack); + void buildIndexValues(velocypack::Builder& leased, + LocalDocumentId const& documentId, + VPackSlice const document, size_t level, + containers::SmallVector& elements, + containers::SmallVector& hashes, + containers::SmallVector& sliceStack); /// @brief the attribute paths (for regular fields) std::vector> _paths; diff --git a/arangod/StorageEngine/TransactionState.h b/arangod/StorageEngine/TransactionState.h index 519c60b46d3b..6dc3d74919eb 100644 --- a/arangod/StorageEngine/TransactionState.h +++ b/arangod/StorageEngine/TransactionState.h @@ -316,8 +316,7 @@ class TransactionState { /// @brief current status transaction::Status _status = transaction::Status::CREATED; - arangodb::containers::SmallVectorWithArena - _collections; + containers::SmallVector _collections; transaction::Hints _hints{}; // hints; set on _nestingLevel == 0 diff --git a/arangod/Transaction/Context.h b/arangod/Transaction/Context.h index ff09cbb21d62..139f084772ab 100644 --- a/arangod/Transaction/Context.h +++ b/arangod/Transaction/Context.h @@ -134,10 +134,8 @@ class Context { TRI_vocbase_t& _vocbase; std::unique_ptr _customTypeHandler; - ::arangodb::containers::SmallVectorWithArena - _builders; - ::arangodb::containers::SmallVectorWithArena _strings; + containers::SmallVector _builders; + containers::SmallVector _strings; arangodb::velocypack::Options _options; diff --git a/arangod/Transaction/Manager.cpp b/arangod/Transaction/Manager.cpp index c45106ce429d..bf09a4888607 100644 --- a/arangod/Transaction/Manager.cpp +++ b/arangod/Transaction/Manager.cpp @@ -1187,8 +1187,8 @@ void Manager::iterateManagedTrx( /// @brief collect forgotten transactions bool Manager::garbageCollect(bool abortAll) { bool didWork = false; - ::arangodb::containers::SmallVectorWithArena toAbort; - ::arangodb::containers::SmallVectorWithArena toErase; + containers::SmallVector toAbort; + containers::SmallVector toErase; uint64_t numAborted = 0; @@ -1284,7 +1284,7 @@ bool Manager::garbageCollect(bool abortAll) { /// @brief abort all transactions matching bool Manager::abortManagedTrx( std::function cb) { - ::arangodb::containers::SmallVectorWithArena toAbort; + containers::SmallVector toAbort; for (size_t bucket = 0; bucket < numBuckets; ++bucket) { READ_LOCKER(locker, _transactions[bucket]._lock); diff --git a/arangod/Zkd/ZkdHelper.cpp b/arangod/Zkd/ZkdHelper.cpp index ff7c2af62d1e..4ae32994b361 100644 --- a/arangod/Zkd/ZkdHelper.cpp +++ b/arangod/Zkd/ZkdHelper.cpp @@ -356,10 +356,7 @@ auto zkd::testInBox(byte_string_view cur, byte_string_view min, BitReader min_reader(min); BitReader max_reader(max); - ::arangodb::containers::SmallVector< - std::pair>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector> - isLargerLowerThanMinMax{a}; + containers::SmallVector, 32> isLargerLowerThanMinMax; isLargerLowerThanMinMax.resize(dimensions); unsigned dim = 0; diff --git a/lib/Containers/SmallVector.h b/lib/Containers/SmallVector.h index 1730ee03604d..4a806ba6000c 100644 --- a/lib/Containers/SmallVector.h +++ b/lib/Containers/SmallVector.h @@ -20,132 +20,20 @@ /// /// @author Jan Steemann //////////////////////////////////////////////////////////////////////////////// - #pragma once -#include -#include - -#include "Basics/debugging.h" +#include -#include "Containers/details/short_alloc.h" +#include +#include namespace arangodb::containers { -#if defined(_MSC_VER) && defined(_DEBUG) -#define MSVC_DEBUG -#endif - -#ifndef MSVC_DEBUG -constexpr static auto minAlignment = std::size_t{1}; -#else -// Make Debug-MSVC happy -constexpr static auto minAlignment = alignof(std::_Container_proxy); -#endif - -template -using SmallVector = - std::vector>; - -// helper class that combines a vector with a small-sized arena. -// objects of this class are supposed to be created on the stack and are -// neither copyable nor movable. -// the interface is a subset of std::vector's interface. -template -class SmallVectorWithArena { - public: - SmallVectorWithArena() noexcept : _vector{_arena} { - // reserve enough room in the arena to avoid early re-allocations later. - // note that the initial allocation will take place in the arena, and not - // use any extra heap memory. - // later allocations can grow the vector beyond the size of the arena, and - // then heap allocations will need to be made. - _vector.reserve(BufSize / sizeof(T)); - } - - SmallVectorWithArena(SmallVectorWithArena const& other) = delete; - SmallVectorWithArena& operator=(SmallVectorWithArena const& other) = delete; - SmallVectorWithArena(SmallVectorWithArena&& other) = delete; - SmallVectorWithArena& operator=(SmallVectorWithArena&& other) = delete; - - using AllocatorType = detail::short_alloc; - using iterator = typename std::vector::iterator; - using const_iterator = typename std::vector::const_iterator; - using reverse_iterator = - typename std::vector::reverse_iterator; - using const_reverse_iterator = - typename std::vector::const_reverse_iterator; - - void reserve(std::size_t n) { _vector.reserve(n); } - - void resize(std::size_t n) { _vector.resize(n); } - - void clear() { _vector.clear(); } - - iterator insert(iterator pos, T const& value) { - return _vector.insert(pos, value); - } - - iterator insert(const_iterator pos, T const& value) { - return _vector.insert(pos, value); - } - - template - void emplace_back(Args&&... args) { - _vector.emplace_back(std::forward(args)...); - } - - void pop_back() { _vector.pop_back(); } - - void push_back(T const& value) { _vector.emplace_back(value); } - - std::size_t size() const noexcept { return _vector.size(); } - - std::size_t capacity() const noexcept { return _vector.capacity(); } - - bool empty() const noexcept { return _vector.empty(); } - - T const* data() const noexcept { return _vector.data(); } - - T const& operator[](std::size_t pos) const noexcept { return _vector[pos]; } - - T& operator[](std::size_t pos) noexcept { return _vector[pos]; } - - T const& at(std::size_t pos) const { return _vector.at(pos); } - - T& at(std::size_t pos) { return _vector.at(pos); } - - T const& front() const noexcept { return _vector.front(); } - - T& front() noexcept { return _vector.front(); } - - T const& back() const noexcept { return _vector.back(); } - - T& back() noexcept { return _vector.back(); } - - iterator begin() { return _vector.begin(); } - iterator end() { return _vector.end(); } - reverse_iterator rbegin() { return _vector.rbegin(); } - reverse_iterator rend() { return _vector.rend(); } - const_iterator begin() const { return _vector.begin(); } - const_iterator end() const { return _vector.end(); } - const_reverse_iterator rbegin() const { return _vector.rbegin(); } - const_reverse_iterator rend() const { return _vector.rend(); } - - SmallVector const& vector() const noexcept { - return _vector; - } - - SmallVector& vector() noexcept { - return _vector; - } +template> +using SmallVector = boost::container::small_vector; - private: - typename SmallVector::allocator_type::arena_type - _arena; - SmallVector _vector; -}; +// We cannot use absl::InlinedVector while they don't fix this issue: +// absl::InlinedVector::data() contains branch +// https://github.com/abseil/abseil-cpp/issues/1165 } // namespace arangodb::containers diff --git a/lib/SimpleHttpClient/SimpleHttpClient.cpp b/lib/SimpleHttpClient/SimpleHttpClient.cpp index 9cf790c04049..d051624f9a25 100644 --- a/lib/SimpleHttpClient/SimpleHttpClient.cpp +++ b/lib/SimpleHttpClient/SimpleHttpClient.cpp @@ -601,9 +601,7 @@ void SimpleHttpClient::setRequest( // basic authorization using ExclusionType = std::pair; - ::arangodb::containers::SmallVector::allocator_type::arena_type - arena; - ::arangodb::containers::SmallVector exclusions{arena}; + containers::SmallVector exclusions; size_t pos = 0; if (!_params._jwt.empty()) { _writeBuffer.appendText(std::string_view("Authorization: bearer ")); diff --git a/tests/Aql/BitFunctionsTest.cpp b/tests/Aql/BitFunctionsTest.cpp index ed44652c86be..ded21f6f18ac 100644 --- a/tests/Aql/BitFunctionsTest.cpp +++ b/tests/Aql/BitFunctionsTest.cpp @@ -46,8 +46,7 @@ namespace { AqlValue callFn(AstNode const& node, char const* input1, char const* input2 = nullptr, char const* input3 = nullptr) { - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; + containers::SmallVector params; auto add = [&](char const* input) { if (input != nullptr) { diff --git a/tests/Aql/DateFunctionsTest.cpp b/tests/Aql/DateFunctionsTest.cpp index 45c62b5f0edc..6d8e16be0c6a 100644 --- a/tests/Aql/DateFunctionsTest.cpp +++ b/tests/Aql/DateFunctionsTest.cpp @@ -140,9 +140,8 @@ TEST(DateFunctionsTest, IS_DATESTRING) { arangodb::aql::AstNode node(NODE_TYPE_FCALL); node.setData(static_cast(&fun)); + containers::SmallVector params; for (auto const& testee : testees) { - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; testee.buildParams(params); AqlValue res = Functions::IsDatestring(&expressionContext, node, params); testee.validateResult(res); @@ -151,6 +150,7 @@ TEST(DateFunctionsTest, IS_DATESTRING) { for (auto& it : params) { it.destroy(); } + params.clear(); } } @@ -200,9 +200,8 @@ TEST(DateFunctionsTest, DATE_COMPARE) { arangodb::aql::AstNode node(NODE_TYPE_FCALL); node.setData(static_cast(&fun)); + containers::SmallVector params; for (auto const& testee : testees) { - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; testee.buildParams(params); AqlValue res = Functions::DateCompare(&expressionContext, node, params); testee.validateResult(res); @@ -210,6 +209,7 @@ TEST(DateFunctionsTest, DATE_COMPARE) { for (auto& it : params) { it.destroy(); } + params.clear(); } } @@ -238,8 +238,7 @@ class DateFunctionsTestDateDiff : public ::testing::Test { double dateDiffMillis; // Average number of days per month in the given dates double avgDaysPerMonth; - SmallVector::allocator_type::arena_type arena; - SmallVector params; + containers::SmallVector params; VPackBuilder dateBuilder; VPackBuilder flagBuilder; VPackBuilder switchBuilder; @@ -250,8 +249,7 @@ class DateFunctionsTestDateDiff : public ::testing::Test { earlierDate("2000-04-01T02:48:42.123"), laterDate("2001-06-13T06:53:48.246"), dateDiffMillis(37857906123), - avgDaysPerMonth(365.0 / 12.0), - params(arena) { + avgDaysPerMonth(365.0 / 12.0) { dateBuilder.openArray(); dateBuilder.add(VPackValue(earlierDate)); dateBuilder.add(VPackValue(laterDate)); @@ -462,8 +460,7 @@ TEST(DateFunctionsTest, DATE_SUBTRACT) { node.setData(static_cast(&fun)); for (auto const& testee : testees) { - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; + containers::SmallVector params; testee.buildParams(params); AqlValue res = Functions::DateSubtract(&expressionContext, node, params); testee.validateResult(res); diff --git a/tests/Aql/DecaysFunctionTest.cpp b/tests/Aql/DecaysFunctionTest.cpp index af36a4ba4312..070f2169d72e 100644 --- a/tests/Aql/DecaysFunctionTest.cpp +++ b/tests/Aql/DecaysFunctionTest.cpp @@ -47,9 +47,8 @@ using namespace arangodb::containers; namespace { // helper functions -SmallVector createArgVec(const VPackSlice slice) { - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; +containers::SmallVector createArgVec(const VPackSlice slice) { + containers::SmallVector params; for (const auto arg : VPackArrayIterator(slice)) { if (arg.isObject()) { @@ -86,12 +85,10 @@ void expectEqSlices(const VPackSlice actualSlice, double expected = expectedSlice.getNumber(); EXPECT_DOUBLE_EQ(expected, actual) << "args: " << args; } - - return; } -AqlValue evaluateDecayFunction(const SmallVector& params, - const arangodb::aql::AstNode& node) { +AqlValue evaluateDecayFunction(std::span params, + arangodb::aql::AstNode const& node) { fakeit::Mock expressionContextMock; ExpressionContext& expressionContext = expressionContextMock.get(); fakeit::When(Method(expressionContextMock, registerWarning)) @@ -128,7 +125,7 @@ void assertDecayFunction(char const* expected, char const* args, ASSERT_TRUE(argsSlice.isArray()); // create params vector from args slice - SmallVector params = createArgVec(argsSlice); + auto params = createArgVec(argsSlice); // evaluate auto actual_value = evaluateDecayFunction(params, node); @@ -152,7 +149,7 @@ void assertDecayFunctionFail(char const* args, ASSERT_TRUE(argsSlice.isArray()); // create params vector from args slice - SmallVector params = createArgVec(argsSlice); + auto params = createArgVec(argsSlice); ASSERT_TRUE(evaluateDecayFunction(params, node).isNull(false)); diff --git a/tests/Aql/DistanceFunctionTest.cpp b/tests/Aql/DistanceFunctionTest.cpp index 9562b31fd970..7954bd19eade 100644 --- a/tests/Aql/DistanceFunctionTest.cpp +++ b/tests/Aql/DistanceFunctionTest.cpp @@ -84,12 +84,10 @@ void expectEqSlices(const VPackSlice actualSlice, double rhs = expectedSlice.getNumber(); ASSERT_DOUBLE_EQ(lhs, rhs); } - - return; } -AqlValue evaluateDistanceFunction(const SmallVector& params, - const arangodb::aql::AstNode& node) { +AqlValue evaluateDistanceFunction(std::span params, + arangodb::aql::AstNode const& node) { fakeit::Mock expressionContextMock; ExpressionContext& expressionContext = expressionContextMock.get(); fakeit::When(Method(expressionContextMock, registerWarning)) @@ -114,7 +112,7 @@ AqlValue evaluateDistanceFunction(const SmallVector& params, } void assertDistanceFunction(char const* expected, char const* x, char const* y, - const arangodb::aql::AstNode& node) { + arangodb::aql::AstNode const& node) { // get slice for expected value auto const expectedJson = VPackParser::fromJson(expected); auto const expectedSlice = expectedJson->slice(); @@ -134,10 +132,9 @@ void assertDistanceFunction(char const* expected, char const* x, char const* y, // create params vector from y slice AqlValue arrayY = createArray(sliceY); - SmallVector::allocator_type::arena_type arena; - SmallVector params{2, arena}; - params[0] = arrayX; - params[1] = arrayY; + containers::SmallVector params; + params.push_back(arrayX); + params.push_back(arrayY); // evaluate auto actual_value = evaluateDistanceFunction(params, node); @@ -169,10 +166,9 @@ void assertDistanceFunctionFail(char const* x, char const* y, // create params vector from y slice AqlValue arrayY = createArray(sliceY); - SmallVector::allocator_type::arena_type arena; - SmallVector params{2, arena}; - params[0] = arrayX; - params[1] = arrayY; + containers::SmallVector params; + params.push_back(arrayX); + params.push_back(arrayY); ASSERT_TRUE(evaluateDistanceFunction(params, node).isNull(false)); diff --git a/tests/Aql/InRangeFunctionTest.cpp b/tests/Aql/InRangeFunctionTest.cpp index fbc781020aa8..d556915b1a36 100644 --- a/tests/Aql/InRangeFunctionTest.cpp +++ b/tests/Aql/InRangeFunctionTest.cpp @@ -68,8 +68,7 @@ class InRangeFunctionTest : public ::testing::Test { fakeit::When(Method(expressionContextMock, trx)) .AlwaysDo([&trx]() -> transaction::Methods& { return *trx; }); - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; + containers::SmallVector params; if (attribute) { params.emplace_back(*attribute); } diff --git a/tests/Aql/JaccardFunctionTest.cpp b/tests/Aql/JaccardFunctionTest.cpp index ed228b2829e6..59e7672bf0ff 100644 --- a/tests/Aql/JaccardFunctionTest.cpp +++ b/tests/Aql/JaccardFunctionTest.cpp @@ -63,8 +63,7 @@ AqlValue evaluate(AqlValue const& lhs, AqlValue const& rhs) { fakeit::When(Method(expressionContextMock, trx)) .AlwaysDo([&trx]() -> transaction::Methods& { return trx; }); - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; + containers::SmallVector params; params.emplace_back(lhs); params.emplace_back(rhs); params.emplace_back(VPackSlice::nullSlice()); // redundant argument diff --git a/tests/Aql/LevenshteinMatchFunctionTest.cpp b/tests/Aql/LevenshteinMatchFunctionTest.cpp index 00e3ef39ef9f..9c8e7206c68f 100644 --- a/tests/Aql/LevenshteinMatchFunctionTest.cpp +++ b/tests/Aql/LevenshteinMatchFunctionTest.cpp @@ -72,8 +72,7 @@ AqlValue evaluate(AqlValue const& lhs, AqlValue const& rhs, fakeit::When(Method(expressionContextMock, trx)) .AlwaysDo([&]() -> transaction::Methods& { return trxMock.get(); }); - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; + containers::SmallVector params; params.reserve(3 + (transpositions ? 2 : 0)); params.emplace_back(lhs); params.emplace_back(rhs); diff --git a/tests/Aql/NgramMatchFunctionTest.cpp b/tests/Aql/NgramMatchFunctionTest.cpp index 54a313bc7e9d..000742b9bb27 100644 --- a/tests/Aql/NgramMatchFunctionTest.cpp +++ b/tests/Aql/NgramMatchFunctionTest.cpp @@ -92,8 +92,7 @@ class NgramMatchFunctionTest : public ::testing::Test { fakeit::When(Method(expressionContextMock, trx)).AlwaysReturn(*trx); fakeit::When(Method(expressionContextMock, vocbase)) .AlwaysReturn(trx->vocbase()); - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; + containers::SmallVector params; if (Attribute) { params.emplace_back(*Attribute); } diff --git a/tests/Aql/NgramPosSimilarityFunctionTest.cpp b/tests/Aql/NgramPosSimilarityFunctionTest.cpp index ac80e9b07b22..72baafcdf568 100644 --- a/tests/Aql/NgramPosSimilarityFunctionTest.cpp +++ b/tests/Aql/NgramPosSimilarityFunctionTest.cpp @@ -66,8 +66,7 @@ class NgramPosSimilarityFunctionTest : public ::testing::Test { auto trx = server.createFakeTransaction(); fakeit::When(Method(expressionContextMock, trx)) .AlwaysDo([&]() -> transaction::Methods& { return *trx; }); - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; + containers::SmallVector params; if (attribute) { params.emplace_back(*attribute); } diff --git a/tests/Aql/NgramSimilarityFunctionTest.cpp b/tests/Aql/NgramSimilarityFunctionTest.cpp index 7988e93266e3..984d6652bb7f 100644 --- a/tests/Aql/NgramSimilarityFunctionTest.cpp +++ b/tests/Aql/NgramSimilarityFunctionTest.cpp @@ -66,8 +66,7 @@ class NgramSimilarityFunctionTest : public ::testing::Test { auto trx = server.createFakeTransaction(); fakeit::When(Method(expressionContextMock, trx)) .AlwaysDo([&]() -> transaction::Methods& { return *trx; }); - SmallVector::allocator_type::arena_type arena; - SmallVector params{arena}; + containers::SmallVector params; if (attribute) { params.emplace_back(*attribute); } diff --git a/tests/Aql/SpliceSubqueryOptimizerRuleTest.cpp b/tests/Aql/SpliceSubqueryOptimizerRuleTest.cpp index 00ee69bb7726..94f3cd165853 100644 --- a/tests/Aql/SpliceSubqueryOptimizerRuleTest.cpp +++ b/tests/Aql/SpliceSubqueryOptimizerRuleTest.cpp @@ -151,11 +151,10 @@ class SpliceSubqueryNodeOptimizerRuleTest : public ::testing::Test { const_cast(splicedQuery->plan()); ASSERT_NE(splicedPlan, nullptr) << "query string: " << querystring; - SmallVector::allocator_type::arena_type a; - SmallVector splicedSubqueryNodes{a}; - SmallVector splicedSubqueryStartNodes{a}; - SmallVector splicedSubqueryEndNodes{a}; - SmallVector splicedSubquerySingletonNodes{a}; + containers::SmallVector splicedSubqueryNodes; + containers::SmallVector splicedSubqueryStartNodes; + containers::SmallVector splicedSubqueryEndNodes; + containers::SmallVector splicedSubquerySingletonNodes; splicedPlan->findNodesOfType(splicedSubqueryNodes, ExecutionNode::SUBQUERY, true); splicedPlan->findNodesOfType(splicedSubqueryStartNodes, diff --git a/tests/Containers/SmallVectorTest.cpp b/tests/Containers/SmallVectorTest.cpp index 22e6f5b70faa..922d1ad8797f 100644 --- a/tests/Containers/SmallVectorTest.cpp +++ b/tests/Containers/SmallVectorTest.cpp @@ -1,321 +1,6 @@ -//////////////////////////////////////////////////////////////////////////////// -/// DISCLAIMER -/// -/// Copyright 2014-2020 ArangoDB GmbH, Cologne, Germany -/// Copyright 2004-2014 triAGENS 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 Jan Steemann -/// @author Copyright 2007-2012, triAGENS GmbH, Cologne, Germany -//////////////////////////////////////////////////////////////////////////////// - -#include "Basics/Common.h" #include "Containers/SmallVector.h" +#include -#include "gtest/gtest.h" -#include - -TEST(SmallVectorTest, test_empty) { - arangodb::containers::SmallVectorWithArena values; - - EXPECT_EQ(values.size(), 0); - EXPECT_EQ(values.capacity(), 32 / sizeof(uint64_t)); - EXPECT_TRUE(values.empty()); - - values.clear(); - - EXPECT_EQ(values.size(), 0); - EXPECT_TRUE(values.empty()); -} - -TEST(SmallVectorTest, test_in_arena) { - arangodb::containers::SmallVectorWithArena values; - - EXPECT_EQ(values.capacity(), 4); - - // all values must be stored in the arena - uint64_t const* arena = reinterpret_cast(&values); - for (size_t i = 0; i < 4; ++i) { - values.push_back(i); - EXPECT_EQ(&values[i], &arena[i]); - } - - // this will overflow the arena - values.push_back(1); - EXPECT_GT(values.capacity(), 4); - - for (size_t i = 0; i < 4; ++i) { - EXPECT_NE(&values[i], &arena[i]); - } -} - -TEST(SmallVectorTest, test_data) { - arangodb::containers::SmallVectorWithArena values; - - EXPECT_EQ(values.capacity(), 4); - - // all values must be stored in the arena - for (size_t i = 0; i < 4; ++i) { - values.push_back(i); - } - - for (size_t i = 0; i < 4; ++i) { - EXPECT_EQ(i, values.data()[i]); - } - - // this will overflow the arena - values.push_back(4); - EXPECT_GT(values.capacity(), 4); - - for (size_t i = 0; i < 5; ++i) { - EXPECT_EQ(i, values.data()[i]); - } -} - -TEST(SmallVectorTest, test_capacity) { - { - arangodb::containers::SmallVectorWithArena values; - - EXPECT_EQ(values.size(), 0); - EXPECT_EQ(values.capacity(), 32 / sizeof(uint64_t)); - EXPECT_TRUE(values.empty()); - - for (size_t i = 0; i < 4; ++i) { - values.push_back(i); - EXPECT_EQ(values.size(), i + 1); - EXPECT_EQ(values.capacity(), 4); - } - - values.push_back(666); - EXPECT_EQ(values.size(), 5); - EXPECT_GT(values.capacity(), 4); - } - - { - arangodb::containers::SmallVectorWithArena values; - - EXPECT_EQ(values.size(), 0); - EXPECT_EQ(values.capacity(), 64 / sizeof(uint32_t)); - EXPECT_TRUE(values.empty()); - - for (size_t i = 0; i < 16; ++i) { - values.push_back(static_cast(i)); - EXPECT_EQ(values.size(), i + 1); - EXPECT_EQ(values.capacity(), 16); - } - - values.push_back(666); - EXPECT_EQ(values.size(), 17); - EXPECT_GT(values.capacity(), 16); - } - - { - arangodb::containers::SmallVectorWithArena values; - - EXPECT_EQ(values.size(), 0); - EXPECT_EQ(values.capacity(), 64 / sizeof(uint32_t)); - EXPECT_TRUE(values.empty()); - values.reserve(1024); - - EXPECT_EQ(values.capacity(), 1024); - EXPECT_EQ(values.size(), 0); - - for (size_t i = 0; i < 1024; ++i) { - values.push_back(static_cast(i)); - EXPECT_EQ(values.size(), i + 1); - EXPECT_EQ(values.capacity(), 1024); - } - - values.push_back(666); - EXPECT_EQ(values.size(), 1025); - EXPECT_GT(values.capacity(), 1024); - } -} - -TEST(SmallVectorTest, test_fillup) { - arangodb::containers::SmallVectorWithArena values; - - values.push_back(0); - EXPECT_EQ(values.size(), 1); - EXPECT_FALSE(values.empty()); - - values.push_back(1); - EXPECT_EQ(values.size(), 2); - EXPECT_FALSE(values.empty()); - - values.push_back(2); - EXPECT_EQ(values.size(), 3); - EXPECT_FALSE(values.empty()); - - values.push_back(3); - EXPECT_EQ(values.size(), 4); - EXPECT_FALSE(values.empty()); - - // heap allocation - values.push_back(4); - EXPECT_EQ(values.size(), 5); - EXPECT_FALSE(values.empty()); - - for (uint64_t i = 0; i < 5; ++i) { - EXPECT_EQ(i, values[i]); - EXPECT_EQ(i, values.at(i)); - } -} - -TEST(SmallVectorTest, test_fillmore) { - arangodb::containers::SmallVectorWithArena values; - - for (uint32_t i = 0; i < 1000; ++i) { - EXPECT_EQ(values.size(), i); - values.push_back(i); - EXPECT_EQ(values.size(), i + 1); - } - EXPECT_EQ(values.size(), 1000); - - for (uint32_t i = 0; i < 1000; ++i) { - EXPECT_EQ(i, values[i]); - EXPECT_EQ(i, values.at(i)); - } - - values.clear(); - EXPECT_EQ(values.size(), 0); - EXPECT_TRUE(values.empty()); -} - -TEST(SmallVectorTest, test_refill) { - arangodb::containers::SmallVectorWithArena values; - - for (uint32_t i = 0; i < 1000; ++i) { - EXPECT_EQ(values.size(), i); - values.push_back(i); - EXPECT_EQ(values.size(), i + 1); - } - values.clear(); - for (uint32_t i = 0; i < 512; ++i) { - values.emplace_back(i * 2); - } - EXPECT_EQ(values.size(), 512); - for (uint32_t i = 0; i < 512; ++i) { - EXPECT_EQ(i * 2, values[i]); - EXPECT_EQ(i * 2, values.at(i)); - } -} - -TEST(SmallVectorTest, test_resize) { - arangodb::containers::SmallVectorWithArena values; - - values.resize(10000); - EXPECT_EQ(values.size(), 10000); - for (uint32_t i = 0; i < 10000; ++i) { - EXPECT_EQ(0, values[i]); - EXPECT_EQ(0, values.at(i)); - } - - values.emplace_back(1); - EXPECT_EQ(values.size(), 10001); - EXPECT_EQ(1, values[10000]); - EXPECT_EQ(1, values.at(10000)); - - values.resize(3); - EXPECT_EQ(values.size(), 3); - for (uint32_t i = 0; i < 3; ++i) { - EXPECT_EQ(0, values[i]); - EXPECT_EQ(0, values.at(i)); - } - - values.resize(0); - EXPECT_EQ(values.size(), 0); -} - -TEST(SmallVectorTest, test_at) { - arangodb::containers::SmallVectorWithArena values; - - EXPECT_THROW(values.at(0), std::out_of_range); - EXPECT_THROW(values.at(1), std::out_of_range); - EXPECT_THROW(values.at(12345), std::out_of_range); - - values.resize(10); - EXPECT_EQ(0, values.at(9)); - EXPECT_THROW(values.at(10), std::out_of_range); -} - -TEST(SmallVectorTest, test_front) { - arangodb::containers::SmallVectorWithArena values; - - values.push_back(666); - EXPECT_EQ(666, values.front()); - - values.push_back(999); - EXPECT_EQ(666, values.front()); - - for (uint64_t i = 0; i < 10; ++i) { - values.push_back(i); - EXPECT_EQ(666, values.front()); - } -} - -TEST(SmallVectorTest, test_back) { - arangodb::containers::SmallVectorWithArena values; - - values.push_back(666); - EXPECT_EQ(666, values.back()); - - values.push_back(999); - EXPECT_EQ(999, values.back()); - - for (uint64_t i = 0; i < 10; ++i) { - values.push_back(i); - EXPECT_EQ(i, values.back()); - } -} - -TEST(SmallVectorTest, test_iterator) { - arangodb::containers::SmallVectorWithArena values; - - EXPECT_EQ(values.begin(), values.end()); - - for (uint64_t i = 0; i < 100; ++i) { - values.push_back(i * 3); - EXPECT_NE(values.begin(), values.end()); - } - - uint64_t i = 0; - auto it = values.begin(); - while (it != values.end()) { - EXPECT_EQ(i * 3, *it); - ++it; - ++i; - } -} - -TEST(SmallVectorTest, test_reverse_iterator) { - arangodb::containers::SmallVectorWithArena values; - - EXPECT_EQ(values.begin(), values.end()); - - for (uint64_t i = 0; i < 100; ++i) { - values.push_back(i * 3); - EXPECT_NE(values.begin(), values.end()); - } - - uint64_t i = 0; - auto it = values.rbegin(); - while (it != values.rend()) { - EXPECT_EQ((100 - i - 1) * 3, *it); - ++it; - ++i; - } -} +static_assert(sizeof(absl::InlinedVector) == 3 * sizeof(std::size_t)); +static_assert(sizeof(arangodb::containers::SmallVector) > + 3 * sizeof(std::size_t)); diff --git a/tests/Geo/GeoConstructorTest.cpp b/tests/Geo/GeoConstructorTest.cpp index aa392dd05935..de18ff76670a 100644 --- a/tests/Geo/GeoConstructorTest.cpp +++ b/tests/Geo/GeoConstructorTest.cpp @@ -59,14 +59,12 @@ class GeoConstructorTest : public ::testing::Test { fakeit::Mock contextMock; transaction::Context& context; - SmallVector::allocator_type::arena_type arena; - SmallVector params; + containers::SmallVector params; GeoConstructorTest() : expressionContext(expressionContextMock.get()), trx(trxMock.get()), - context(contextMock.get()), - params{arena} { + context(contextMock.get()) { static VPackOptions options = velocypack::Options::Defaults; fakeit::When(Method(trxMock, transactionContextPtr)).AlwaysReturn(&context); fakeit::When(Method(trxMock, vpackOptions)).AlwaysReturn(options); diff --git a/tests/Geo/GeoFunctionsTest.cpp b/tests/Geo/GeoFunctionsTest.cpp index 839988121081..c3bd5d3d631b 100644 --- a/tests/Geo/GeoFunctionsTest.cpp +++ b/tests/Geo/GeoFunctionsTest.cpp @@ -49,7 +49,7 @@ namespace arangodb { namespace tests { namespace geo_functions_aql { -auto clearVector = [](SmallVector& v) { +auto clearVector = [](containers::SmallVector& v) { for (auto& it : v) { it.destroy(); } @@ -66,10 +66,9 @@ class GeoEqualsTest : public ::testing::Test { fakeit::Mock contextMock; transaction::Context& context; - SmallVector::allocator_type::arena_type arena; - SmallVector paramsA; - SmallVector paramsB; - SmallVector paramsC; + containers::SmallVector paramsA; + containers::SmallVector paramsB; + containers::SmallVector paramsC; arangodb::aql::Function equalsFun; arangodb::aql::AstNode equalsFunNode; @@ -78,9 +77,6 @@ class GeoEqualsTest : public ::testing::Test { : expressionContext(expressionContextMock.get()), trx(trxMock.get()), context(contextMock.get()), - paramsA{arena}, - paramsB{arena}, - paramsC{arena}, equalsFun("GEO_EQUALS", &Functions::GeoEquals), equalsFunNode(NODE_TYPE_FCALL) { equalsFunNode.setData(static_cast(&equalsFun)); @@ -732,15 +728,13 @@ TEST(GeoInRangeTest, test) { "type": "Point", "coordinates": [37.605, 55.707917] })"); - SmallVector::allocator_type::arena_type arena; - { fakeit::When(Method(expressionContextMock, registerWarning)) .Do([&](ErrorCode code, char const*) -> void { ASSERT_EQ(code, TRI_ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH); }); - SmallVector params{{}, arena}; + containers::SmallVector params; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -758,11 +752,9 @@ TEST(GeoInRangeTest, test) { .Do([&](ErrorCode code, char const*) -> void { ASSERT_EQ(code, TRI_ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH); }); - - SmallVector params{{ - AqlValue{lhs->slice()}, - }, - arena}; + containers::SmallVector params = { + AqlValue{lhs->slice()}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -781,11 +773,10 @@ TEST(GeoInRangeTest, test) { ASSERT_EQ(code, TRI_ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH); }); - SmallVector params{{ - AqlValue{lhs->slice()}, - AqlValue{lhs->slice()}, - }, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{lhs->slice()}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -804,12 +795,11 @@ TEST(GeoInRangeTest, test) { ASSERT_EQ(code, TRI_ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH); }); - SmallVector params{{ - AqlValue{lhs->slice()}, - AqlValue{lhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, - }, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{lhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -823,13 +813,12 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{{ - AqlValue{lhs->slice()}, - AqlValue{lhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, - AqlValue{AqlValueHintDouble{0}}, - }, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{lhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintDouble{0}}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -844,11 +833,14 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{lhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, AqlValue{AqlValueHintDouble{0}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{lhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -863,11 +855,11 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{lhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, AqlValue{AqlValueHintDouble{0}}, - AqlValue{AqlValueHintBool{true}}, AqlValue{AqlValueHintBool{false}}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, AqlValue{lhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintBool{true}}, AqlValue{AqlValueHintBool{false}}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -882,11 +874,14 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{lhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, AqlValue{AqlValueHintDouble{0}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{true}}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{lhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{true}}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -901,11 +896,14 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, AqlValue{AqlValueHintDouble{100}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintDouble{100}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -920,13 +918,12 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{{ - AqlValue{lhs->slice()}, - AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, - AqlValue{AqlValueHintDouble{100}}, - }, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintDouble{100}}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -941,12 +938,15 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, AqlValue{AqlValueHintDouble{100}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintDouble{100}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -961,12 +961,15 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{ - {AqlValue{rhs->slice()}, AqlValue{lhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, AqlValue{AqlValueHintDouble{100}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{rhs->slice()}, + AqlValue{lhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintDouble{100}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -981,15 +984,15 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{ - { - AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, AqlValue{AqlValueHintDouble{100}}, - AqlValue{AqlValueHintBool{false}}, - AqlValue{AqlValueHintBool{false}}, - AqlValue{"foo"} // fallback to 'sphere' - }, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintDouble{100}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"foo"} // fallback to 'sphere' + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1004,15 +1007,15 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{ - { - AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{0}}, AqlValue{AqlValueHintDouble{100}}, - AqlValue{AqlValueHintBool{false}}, - AqlValue{AqlValueHintBool{false}}, - AqlValue{AqlValueHintBool{false}} // fallback to 'sphere' - }, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{0}}, + AqlValue{AqlValueHintDouble{100}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}} // fallback to 'sphere' + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1027,11 +1030,14 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{1}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{1}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1046,13 +1052,12 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{{ - AqlValue{lhs->slice()}, - AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{1}}, - AqlValue{AqlValueHintDouble{400}}, - }, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{1}}, + AqlValue{AqlValueHintDouble{400}}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1067,12 +1072,15 @@ TEST(GeoInRangeTest, test) { } { - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{1}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{1}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1100,15 +1108,11 @@ TEST(GeoInRangeTest, test) { ] })"); - SmallVector params{{ - AqlValue{shapeJson->slice()}, - AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{240}}, - AqlValue{AqlValueHintDouble{242}}, - AqlValue{AqlValueHintBool{false}}, - AqlValue{AqlValueHintBool{false}}, - }, - arena}; + containers::SmallVector params{ + AqlValue{shapeJson->slice()}, AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{240}}, AqlValue{AqlValueHintDouble{242}}, + AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1128,12 +1132,16 @@ TEST(GeoInRangeTest, test) { ASSERT_EQ(code, TRI_ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH); }); - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{1}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}, AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{1}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1156,12 +1164,15 @@ TEST(GeoInRangeTest, test) { "type": "PPint", "coordinates": [37.610235, 55.709754] })"); - SmallVector params{ - {AqlValue{invalidJson->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{1}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{invalidJson->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{1}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1180,12 +1191,15 @@ TEST(GeoInRangeTest, test) { ASSERT_EQ(code, TRI_ERROR_BAD_PARAMETER); }); - SmallVector params{ - {AqlValue{AqlValueHintBool{false}}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{1}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{AqlValueHintBool{false}}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{1}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1208,12 +1222,15 @@ TEST(GeoInRangeTest, test) { "type": "PPint", "coordinates": [37.610235, 55.709754] })"); - SmallVector params{ - {AqlValue{rhs->slice()}, AqlValue{invalidJson->slice()}, - AqlValue{AqlValueHintDouble{1}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{rhs->slice()}, + AqlValue{invalidJson->slice()}, + AqlValue{AqlValueHintDouble{1}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1232,12 +1249,15 @@ TEST(GeoInRangeTest, test) { ASSERT_EQ(code, TRI_ERROR_BAD_PARAMETER); }); - SmallVector params{ - {AqlValue{rhs->slice()}, AqlValue{AqlValueHintBool{false}}, - AqlValue{AqlValueHintDouble{1}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintDouble{1}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1256,12 +1276,15 @@ TEST(GeoInRangeTest, test) { ASSERT_EQ(code, TRI_ERROR_BAD_PARAMETER); }); - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1280,12 +1303,15 @@ TEST(GeoInRangeTest, test) { ASSERT_EQ(code, TRI_ERROR_BAD_PARAMETER); }); - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{400}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1304,12 +1330,15 @@ TEST(GeoInRangeTest, test) { ASSERT_EQ(code, TRI_ERROR_BAD_PARAMETER); }); - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{100}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{AqlValueHintDouble{400}}, AqlValue{AqlValueHintBool{false}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{100}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { @@ -1328,12 +1357,15 @@ TEST(GeoInRangeTest, test) { ASSERT_EQ(code, TRI_ERROR_BAD_PARAMETER); }); - SmallVector params{ - {AqlValue{lhs->slice()}, AqlValue{rhs->slice()}, - AqlValue{AqlValueHintDouble{100}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{AqlValueHintBool{false}}, AqlValue{AqlValueHintDouble{400}}, - AqlValue{"wg84"}}, - arena}; + containers::SmallVector params{ + AqlValue{lhs->slice()}, + AqlValue{rhs->slice()}, + AqlValue{AqlValueHintDouble{100}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{AqlValueHintBool{false}}, + AqlValue{AqlValueHintDouble{400}}, + AqlValue{"wg84"}, + }; auto guard = arangodb::scopeGuard([¶ms]() noexcept { for (auto& p : params) { diff --git a/tests/IResearch/ExpressionFilterTest.cpp b/tests/IResearch/ExpressionFilterTest.cpp index afe967a29195..cfaa842e0bba 100644 --- a/tests/IResearch/ExpressionFilterTest.cpp +++ b/tests/IResearch/ExpressionFilterTest.cpp @@ -356,7 +356,7 @@ struct IResearchExpressionFilterTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); diff --git a/tests/IResearch/IResearchAnalyzerFeatureTest.cpp b/tests/IResearch/IResearchAnalyzerFeatureTest.cpp index 0129a7de44eb..16d55e695c03 100644 --- a/tests/IResearch/IResearchAnalyzerFeatureTest.cpp +++ b/tests/IResearch/IResearchAnalyzerFeatureTest.cpp @@ -392,10 +392,8 @@ std::map const& staticAnalyzers() { // AqlValue entries must be explicitly deallocated struct VPackFunctionParametersWrapper { - arangodb::containers::SmallVector< - arangodb::aql::AqlValue>::allocator_type::arena_type arena; arangodb::aql::VPackFunctionParameters instance; - VPackFunctionParametersWrapper() : instance(arena) {} + VPackFunctionParametersWrapper() = default; ~VPackFunctionParametersWrapper() { for (auto& entry : instance) { entry.destroy(); @@ -3275,9 +3273,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_tokens) { // test invalid arg count // Zero count (less than expected) { - arangodb::containers::SmallVector< - arangodb::aql::AqlValue>::allocator_type::arena_type arena; - arangodb::aql::VPackFunctionParameters args{arena}; + arangodb::aql::VPackFunctionParameters args; EXPECT_THROW(AqlValueWrapper(impl(&exprCtx, node, args)), arangodb::basics::Exception); } diff --git a/tests/IResearch/IResearchFilterArrayInTest.cpp b/tests/IResearch/IResearchFilterArrayInTest.cpp index 6c35507522b4..67bb4d454be5 100644 --- a/tests/IResearch/IResearchFilterArrayInTest.cpp +++ b/tests/IResearch/IResearchFilterArrayInTest.cpp @@ -107,7 +107,7 @@ class IResearchFilterArrayInTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); @@ -123,7 +123,7 @@ class IResearchFilterArrayInTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); diff --git a/tests/IResearch/IResearchFilterArrayIntervalTest.cpp b/tests/IResearch/IResearchFilterArrayIntervalTest.cpp index 222417acfe83..27d8efac290e 100644 --- a/tests/IResearch/IResearchFilterArrayIntervalTest.cpp +++ b/tests/IResearch/IResearchFilterArrayIntervalTest.cpp @@ -106,7 +106,7 @@ class IResearchFilterArrayIntervalTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); @@ -122,7 +122,7 @@ class IResearchFilterArrayIntervalTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); diff --git a/tests/IResearch/IResearchFilterBooleanTest.cpp b/tests/IResearch/IResearchFilterBooleanTest.cpp index 792ee14b3eb0..5423eabdcf84 100644 --- a/tests/IResearch/IResearchFilterBooleanTest.cpp +++ b/tests/IResearch/IResearchFilterBooleanTest.cpp @@ -109,7 +109,7 @@ class IResearchFilterBooleanTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); @@ -125,7 +125,7 @@ class IResearchFilterBooleanTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); diff --git a/tests/IResearch/IResearchFilterCompareTest.cpp b/tests/IResearch/IResearchFilterCompareTest.cpp index 3281c1b2923d..67c818697960 100644 --- a/tests/IResearch/IResearchFilterCompareTest.cpp +++ b/tests/IResearch/IResearchFilterCompareTest.cpp @@ -109,7 +109,7 @@ class IResearchFilterCompareTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); @@ -125,7 +125,7 @@ class IResearchFilterCompareTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); diff --git a/tests/IResearch/IResearchFilterFunctionTest.cpp b/tests/IResearch/IResearchFilterFunctionTest.cpp index cd71316c2993..af1856d63c32 100644 --- a/tests/IResearch/IResearchFilterFunctionTest.cpp +++ b/tests/IResearch/IResearchFilterFunctionTest.cpp @@ -111,7 +111,7 @@ class IResearchFilterFunctionTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); @@ -127,7 +127,7 @@ class IResearchFilterFunctionTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); diff --git a/tests/IResearch/IResearchFilterGeoTest.cpp b/tests/IResearch/IResearchFilterGeoTest.cpp index e872b35f82f7..f606b587023d 100644 --- a/tests/IResearch/IResearchFilterGeoTest.cpp +++ b/tests/IResearch/IResearchFilterGeoTest.cpp @@ -104,7 +104,7 @@ class IResearchFilterGeoFunctionsTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); @@ -120,7 +120,7 @@ class IResearchFilterGeoFunctionsTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); diff --git a/tests/IResearch/IResearchFilterInTest.cpp b/tests/IResearch/IResearchFilterInTest.cpp index 17dc746084e7..80aa4ba2c69d 100644 --- a/tests/IResearch/IResearchFilterInTest.cpp +++ b/tests/IResearch/IResearchFilterInTest.cpp @@ -109,7 +109,7 @@ class IResearchFilterInTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); @@ -125,7 +125,7 @@ class IResearchFilterInTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); diff --git a/tests/IResearch/IResearchInvertedIndexConditionTest.cpp b/tests/IResearch/IResearchInvertedIndexConditionTest.cpp index 012c978b65e8..e30db873e503 100644 --- a/tests/IResearch/IResearchInvertedIndexConditionTest.cpp +++ b/tests/IResearch/IResearchInvertedIndexConditionTest.cpp @@ -214,9 +214,7 @@ class IResearchInvertedIndexConditionTest std::vector> sorts; { - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector sortNodes{a}; + arangodb::containers::SmallVector sortNodes; plan->findNodesOfType(sortNodes, {ExecutionNode::SORT}, false); for (auto s : sortNodes) { auto sortNode = arangodb::aql::ExecutionNode::castTo(s); @@ -229,9 +227,7 @@ class IResearchInvertedIndexConditionTest std::unordered_map variableDefinitions; { - ::arangodb::containers::SmallVector< - ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector setNodes{a}; + arangodb::containers::SmallVector setNodes; plan->findNodesOfType(setNodes, {ExecutionNode::CALCULATION}, false); for (auto n : setNodes) { auto en = ExecutionNode::castTo(n); diff --git a/tests/IResearch/IResearchQueryCommon.h b/tests/IResearch/IResearchQueryCommon.h index 73a0b5893ad7..79abb95109f5 100644 --- a/tests/IResearch/IResearchQueryCommon.h +++ b/tests/IResearch/IResearchQueryCommon.h @@ -160,7 +160,7 @@ class IResearchQueryTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); @@ -176,7 +176,7 @@ class IResearchQueryTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); diff --git a/tests/IResearch/IResearchQueryOptimizationTest.cpp b/tests/IResearch/IResearchQueryOptimizationTest.cpp index 5ad308f85e4d..7d4d7353f305 100644 --- a/tests/IResearch/IResearchQueryOptimizationTest.cpp +++ b/tests/IResearch/IResearchQueryOptimizationTest.cpp @@ -69,9 +69,7 @@ bool findEmptyNodes( query->prepareQuery(arangodb::aql::SerializationFormat::SHADOWROWS); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // try to find `EnumerateViewNode`s and process corresponding filters and // sorts diff --git a/tests/IResearch/IResearchQueryScorerTest.cpp b/tests/IResearch/IResearchQueryScorerTest.cpp index e71a458313ee..a99795d318d3 100644 --- a/tests/IResearch/IResearchQueryScorerTest.cpp +++ b/tests/IResearch/IResearchQueryScorerTest.cpp @@ -576,9 +576,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -684,9 +682,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -797,9 +793,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -909,9 +903,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -1022,9 +1014,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -1135,9 +1125,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -1257,9 +1245,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -1370,9 +1356,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -1459,9 +1443,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -1549,9 +1531,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -1670,9 +1650,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -1759,9 +1737,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // only one scorer plan->findNodesOfType( @@ -1843,9 +1819,7 @@ TEST_P(IResearchQueryScorerTest, test) { auto* plan = query->plan(); ASSERT_TRUE(plan); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; // 2 scorers scorer plan->findNodesOfType( diff --git a/tests/IResearch/IResearchViewCountApproximateTest.cpp b/tests/IResearch/IResearchViewCountApproximateTest.cpp index f7de437e45c7..fea70a1f44b8 100644 --- a/tests/IResearch/IResearchViewCountApproximateTest.cpp +++ b/tests/IResearch/IResearchViewCountApproximateTest.cpp @@ -527,9 +527,7 @@ TEST_F(IResearchViewCountApproximateTest, directSkipAllForMergeExecutorExact) { arangodb::aql::ExecutionPlan::instantiateFromAst(query->ast(), false); plan->planRegisters(); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(1, nodes.size()); @@ -608,9 +606,7 @@ TEST_F(IResearchViewCountApproximateTest, arangodb::aql::ExecutionPlan::instantiateFromAst(query->ast(), false); plan->planRegisters(); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(1, nodes.size()); @@ -691,9 +687,7 @@ TEST_F(IResearchViewCountApproximateTest, directSkipAllForMergeExecutorCost) { arangodb::aql::ExecutionPlan::instantiateFromAst(query->ast(), false); plan->planRegisters(); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(1, nodes.size()); diff --git a/tests/IResearch/IResearchViewNodeTest.cpp b/tests/IResearch/IResearchViewNodeTest.cpp index f5a2d3b21711..71b42c329273 100644 --- a/tests/IResearch/IResearchViewNodeTest.cpp +++ b/tests/IResearch/IResearchViewNodeTest.cpp @@ -3866,9 +3866,7 @@ TEST_F(IResearchViewVolatitlityTest, volatilityFilterSubqueryWithVar) { auto prepared = arangodb::tests::prepareQuery(*vocbase, queryString); auto plan = prepared->plan(); ASSERT_NE(nullptr, plan); - ::arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(2, nodes.size()); @@ -3900,9 +3898,7 @@ TEST_F(IResearchViewVolatitlityTest, volatilityFilterSubquery) { auto prepared = arangodb::tests::prepareQuery(*vocbase, queryString); auto plan = prepared->plan(); ASSERT_NE(nullptr, plan); - ::arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(2, nodes.size()); @@ -3934,9 +3930,7 @@ TEST_F(IResearchViewVolatitlityTest, volatilityFilterNonDetVar) { auto prepared = arangodb::tests::prepareQuery(*vocbase, queryString); auto plan = prepared->plan(); ASSERT_NE(nullptr, plan); - ::arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(2, nodes.size()); @@ -3968,9 +3962,7 @@ TEST_F(IResearchViewVolatitlityTest, volatilityFilterListWithVar) { auto prepared = arangodb::tests::prepareQuery(*vocbase, queryString); auto plan = prepared->plan(); ASSERT_NE(nullptr, plan); - ::arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(1, nodes.size()); @@ -3999,9 +3991,7 @@ TEST_F(IResearchViewVolatitlityTest, volatilityFilterList) { auto prepared = arangodb::tests::prepareQuery(*vocbase, queryString); auto plan = prepared->plan(); ASSERT_NE(nullptr, plan); - ::arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(1, nodes.size()); @@ -4030,9 +4020,7 @@ TEST_F(IResearchViewVolatitlityTest, volatilityFilterListNonVolatile) { auto prepared = arangodb::tests::prepareQuery(*vocbase, queryString); auto plan = prepared->plan(); ASSERT_NE(nullptr, plan); - ::arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(1, nodes.size()); @@ -4061,9 +4049,7 @@ TEST_F(IResearchViewVolatitlityTest, volatilityFilterQueryNonVolatile) { auto prepared = arangodb::tests::prepareQuery(*vocbase, queryString); auto plan = prepared->plan(); ASSERT_NE(nullptr, plan); - ::arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(2, nodes.size()); @@ -4096,9 +4082,7 @@ TEST_F(IResearchViewVolatitlityTest, volatilityFilterListSubquery) { auto prepared = arangodb::tests::prepareQuery(*vocbase, queryString); auto plan = prepared->plan(); ASSERT_NE(nullptr, plan); - ::arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(2, nodes.size()); @@ -4131,9 +4115,7 @@ TEST_F(IResearchViewVolatitlityTest, volatilitySortFilterListSubquery) { auto prepared = arangodb::tests::prepareQuery(*vocbase, queryString); auto plan = prepared->plan(); ASSERT_NE(nullptr, plan); - ::arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(2, nodes.size()); @@ -4166,9 +4148,7 @@ TEST_F(IResearchViewVolatitlityTest, volatilitySortNonVolatileFilter) { auto prepared = arangodb::tests::prepareQuery(*vocbase, queryString); auto plan = prepared->plan(); ASSERT_NE(nullptr, plan); - ::arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - ::arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, {arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW}, true); ASSERT_EQ(2, nodes.size()); diff --git a/tests/IResearch/IResearchViewSortedTest.cpp b/tests/IResearch/IResearchViewSortedTest.cpp index 4e6b0fb44b97..cda9e82635be 100644 --- a/tests/IResearch/IResearchViewSortedTest.cpp +++ b/tests/IResearch/IResearchViewSortedTest.cpp @@ -105,7 +105,7 @@ class IResearchViewSortedTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); @@ -121,7 +121,7 @@ class IResearchViewSortedTest arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, - arangodb::aql::VPackFunctionParameters const& params) { + arangodb::aql::VPackFunctionParametersView params) { TRI_ASSERT(!params.empty()); return params[0]; }}); @@ -276,9 +276,7 @@ TEST_P(IResearchViewSortedTest, SingleField) { vocbase, query, {arangodb::aql::OptimizerRule::handleArangoSearchViewsRule})); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; auto preparedQuery = arangodb::tests::prepareQuery(vocbase, query); auto plan = preparedQuery->plan(); ASSERT_TRUE(plan); @@ -330,9 +328,7 @@ TEST_P(IResearchViewSortedTest, SingleField) { vocbase, query, {arangodb::aql::OptimizerRule::handleArangoSearchViewsRule})); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; auto preparedQuery = arangodb::tests::prepareQuery(vocbase, query); auto plan = preparedQuery->plan(); ASSERT_TRUE(plan); @@ -392,9 +388,7 @@ TEST_P(IResearchViewSortedTest, SingleField) { vocbase, query, {arangodb::aql::OptimizerRule::handleArangoSearchViewsRule})); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; auto preparedQuery = arangodb::tests::prepareQuery(vocbase, query); auto plan = preparedQuery->plan(); ASSERT_TRUE(plan); @@ -583,9 +577,7 @@ TEST_P(IResearchViewSortedTest, MultipleFields) { vocbase, query, {arangodb::aql::OptimizerRule::handleArangoSearchViewsRule})); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; auto preparedQuery = arangodb::tests::prepareQuery(vocbase, query); auto plan = preparedQuery->plan(); ASSERT_TRUE(plan); @@ -636,9 +628,7 @@ TEST_P(IResearchViewSortedTest, MultipleFields) { vocbase, query, {arangodb::aql::OptimizerRule::handleArangoSearchViewsRule})); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; auto preparedQuery = arangodb::tests::prepareQuery(vocbase, query); auto plan = preparedQuery->plan(); ASSERT_TRUE(plan); @@ -690,9 +680,7 @@ TEST_P(IResearchViewSortedTest, MultipleFields) { vocbase, query, {arangodb::aql::OptimizerRule::handleArangoSearchViewsRule})); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; auto preparedQuery = arangodb::tests::prepareQuery(vocbase, query); auto plan = preparedQuery->plan(); ASSERT_TRUE(plan); @@ -752,9 +740,7 @@ TEST_P(IResearchViewSortedTest, MultipleFields) { vocbase, query, {arangodb::aql::OptimizerRule::handleArangoSearchViewsRule})); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; auto preparedQuery = arangodb::tests::prepareQuery(vocbase, query); auto plan = preparedQuery->plan(); ASSERT_TRUE(plan); @@ -812,9 +798,7 @@ TEST_P(IResearchViewSortedTest, MultipleFields) { vocbase, query, {arangodb::aql::OptimizerRule::handleArangoSearchViewsRule})); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; auto preparedQuery = arangodb::tests::prepareQuery(vocbase, query); auto plan = preparedQuery->plan(); ASSERT_TRUE(plan); diff --git a/tests/IResearch/common.cpp b/tests/IResearch/common.cpp index b5898964a1ad..93cd23cf5e50 100644 --- a/tests/IResearch/common.cpp +++ b/tests/IResearch/common.cpp @@ -658,9 +658,7 @@ void assertFilterOptimized( EXPECT_TRUE(query->plan()); auto plan = const_cast(query->plan()); - arangodb::containers::SmallVector< - arangodb::aql::ExecutionNode*>::allocator_type::arena_type a; - arangodb::containers::SmallVector nodes{a}; + arangodb::containers::SmallVector nodes; plan->findNodesOfType( nodes, arangodb::aql::ExecutionNode::ENUMERATE_IRESEARCH_VIEW, true);