Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Supervised AqlValue] Make functions use supervised AqlValue#22106

New issue

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

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

Already on GitHub?Sign in to your account

Open
cpjulia wants to merge61 commits intofeature/supervised-aql-value
base:feature/supervised-aql-value
Choose a base branch
Loading
fromfeature/supervised-aql-functions
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
61 commits
Select commitHold shift + click to select a range
4695ddc
Add resource monitor as argument to AqlValue
cpjuliaNov 14, 2025
8bf38cf
Format and add getter for resource monitor in Functions
cpjuliaNov 14, 2025
b3f570c
Add ResourceMonitor to ComputedValuesExpressionContext; Add getResour…
knakatasfNov 14, 2025
f4c98a3
Fix compilation errors
cpjuliaNov 17, 2025
7c96a1c
Fix compilation errors
cpjuliaNov 17, 2025
ac12386
Add resource monitor to AqlValue ctor call
cpjuliaNov 17, 2025
a80de9d
Add resource monitor to IResearch callers that need to pass it
cpjuliaNov 17, 2025
4b44e5a
Add ResourceMonitor* to DecayFunctions.cpp DistanceFunctions.cpp Dist…
knakatasfNov 17, 2025
6132af1
Add resource monitor to remaining IResearh files
cpjuliaNov 17, 2025
349c88d
Add ResourceMonitor* to those Functions
knakatasfNov 17, 2025
a21a067
Change signature of convertToObject() of DistributeFunctions.cpp; Pas…
knakatasfNov 17, 2025
98875a2
Add ResourceMonitor* to ComputedValues.cpp
knakatasfNov 17, 2025
69bf641
Add ResourceMonitor* to Expression.cpp
knakatasfNov 18, 2025
f725133
Add monitor to expression contexts
cpjuliaNov 18, 2025
bf3392e
Add monitor to expression
cpjuliaNov 18, 2025
2c5d770
Fix monitor usage in Expression, already had as member
cpjuliaNov 18, 2025
0c9e57a
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaNov 18, 2025
d5c571e
Add monitor usage to LateMaterializedExpressionContext
cpjuliaNov 18, 2025
f62f392
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaNov 18, 2025
1617e38
Add access to monitor in Variable
cpjuliaNov 19, 2025
2f49ac3
Add rm to missing ctor callers
cpjuliaNov 19, 2025
7692c69
Correct complier errors for Expression.cpp; Add ResourceMonitor* to C…
knakatasfNov 19, 2025
42855b2
Format code
knakatasfNov 19, 2025
5e0b8f4
Fixed typos
cpjuliaNov 19, 2025
a5ceec2
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaNov 19, 2025
d12b34d
Attempt to fix memory leak failure
cpjuliaNov 21, 2025
371dc5b
Add check for nullptr
cpjuliaNov 21, 2025
aecb218
Added monitor support to tests
cpjuliaNov 22, 2025
b0b9ac7
Brought back wrong logic of hashing
cpjuliaNov 23, 2025
34bb289
Merge branch 'devel' of github.com:arangodb/arangodb into feature/sup…
cpjuliaNov 23, 2025
4b58613
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaNov 30, 2025
3eef984
Change cloneDataAndMoveShadow to always steal the guard
cpjuliaNov 30, 2025
720ee57
Added fix for use-after-free in cloneDataAndMoveShadow
cpjuliaDec 1, 2025
bfc9715
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 1, 2025
ac2c304
Add special case for supervised slice in cloneDataAndMoveShadow
cpjuliaDec 1, 2025
7ea92bf
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 1, 2025
0f42608
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 1, 2025
1fe66cb
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 2, 2025
d7e9d31
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 2, 2025
049fe01
Remove special case for supervised slice from cloneDataAndMoveShadow
cpjuliaDec 2, 2025
8cad3f7
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 3, 2025
8ad3a1f
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 3, 2025
6e64bde
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 3, 2025
8222211
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 3, 2025
788a006
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 4, 2025
a464c41
Merge remote-tracking branch 'origin/devel' into feature/supervised-a…
cpjuliaDec 4, 2025
7c01568
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 4, 2025
9e56a4f
Merge branch 'feature/supervised-aql-functions' of github.com:arangod…
cpjuliaDec 4, 2025
16d876f
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 5, 2025
c6d2c9d
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 5, 2025
3ec2380
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 8, 2025
cdcb261
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 9, 2025
2812ca4
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 10, 2025
c76d91f
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 10, 2025
22afa88
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 12, 2025
653a0a4
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 12, 2025
f48b51d
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 15, 2025
77d334e
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 15, 2025
9baaf97
Merge feature/supervised-aql-value
cpjuliaDec 17, 2025
7fe5b98
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 17, 2025
2e7fad9
Merge branch 'feature/supervised-aql-value' of github.com:arangodb/ar…
cpjuliaDec 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletionsarangod/Aql/AqlItemBlock.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -510,10 +510,9 @@ SharedAqlItemBlockPtr AqlItemBlock::cloneDataAndMoveShadow() {
AqlValueGuard guard{a, true};
auto [it, inserted] = cache.emplace(a.data());
res->setValue(row, col, AqlValue(a, (*it)));
if (inserted) {
// otherwise, destroy this; we used a cached value.
guard.steal();
}
// Always steal the guard since ownership has been transferred to
// the new block.
guard.steal();
} else {
res->setValue(row, col, a);
}
Expand Down
2 changes: 2 additions & 0 deletionsarangod/Aql/AqlValue.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -311,12 +311,14 @@ struct AqlValue final {
// PD points to [ ResourceMonitor* | Actual Data ]
// So 'pointer' itself is a pointer to a pointer
arangodb::ResourceMonitor* getResourceMonitor() const noexcept {
TRI_ASSERT(pointer != nullptr);
return *reinterpret_cast<arangodb::ResourceMonitor* const*>(pointer);
}

// Actual data starts at the 9th byte!!!
// pointer's first 8 bytes are the pointer of ResourceMonitor
uint8_t* getPayloadPtr() const noexcept {
TRI_ASSERT(pointer != nullptr);
return pointer + sizeof(arangodb::ResourceMonitor*);
}
uint64_t lengthOrigin; // The first 8 bytes looks like
Expand Down
6 changes: 4 additions & 2 deletionsarangod/Aql/DocumentExpressionContext.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,7 +58,8 @@ AqlValue SimpleDocumentExpressionContext::getVariableValue(
mustDestroy = doCopy;
// return current document
if (doCopy) {
return AqlValue(AqlValueHintSliceCopy(_document));
return AqlValue(AqlValueHintSliceCopy(_document),
getResourceMonitorPtr());
}
return AqlValue(AqlValueHintSliceNoCopy(_document));
});
Expand All@@ -82,7 +83,8 @@ AqlValue GenericDocumentExpressionContext::getVariableValue(
if (variable->id == _outputVariable->id) {
// return current document
if (doCopy) {
return AqlValue(AqlValueHintSliceCopy(_document));
return AqlValue(AqlValueHintSliceCopy(_document),
getResourceMonitorPtr());
}
return AqlValue(AqlValueHintSliceNoCopy(_document));
}
Expand Down
19 changes: 11 additions & 8 deletionsarangod/Aql/Expression.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -678,7 +678,8 @@ AqlValue Expression::executeSimpleExpressionArray(ExpressionContext& ctx,

builder->close();
mustDestroy = true; // AqlValue contains builder contains dynamic data
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = ctx.getResourceMonitorPtr();
return AqlValue(builder->slice(), builder->size(), rm);
}

// execute an expression of type ExpressionType::kSimple with OBJECT
Expand DownExpand Up@@ -792,8 +793,8 @@ AqlValue Expression::executeSimpleExpressionObject(ExpressionContext& ctx,
builder->close();

mustDestroy = true; // AqlValue contains builder contains dynamic data

return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = ctx.getResourceMonitorPtr();
return AqlValue(builder->slice(), builder->size(), rm);
}

// execute an expression of type ExpressionType::kSimple with VALUE
Expand DownExpand Up@@ -975,7 +976,8 @@ AqlValue Expression::invokeV8Function(
TRI_V8ToVPack(isolate, *builder.get(), result, false);

mustDestroy = true; // builder = dynamic data
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = ctx.getResourceMonitorPtr();
return AqlValue(builder->slice(), builder->size(), rm);
}
#endif

Expand DownExpand Up@@ -1626,7 +1628,7 @@ AqlValue Expression::executeSimpleExpressionExpansion(ExpressionContext& ctx,
auto levels = node->getIntValue(true);

AqlValue value;

ResourceMonitor* rm = ctx.getResourceMonitorPtr();
if (levels > 1) {
// flatten value...
bool localMustDestroy;
Expand DownExpand Up@@ -1674,7 +1676,8 @@ AqlValue Expression::executeSimpleExpressionExpansion(ExpressionContext& ctx,
builder.close();

mustDestroy = true; // builder = dynamic data
value = AqlValue(std::move(buffer));

value = AqlValue(std::move(buffer), rm);
} else {
bool localMustDestroy;
AqlValue a = executeSimpleExpression(ctx, node->getMember(0),
Expand DownExpand Up@@ -1855,8 +1858,8 @@ AqlValue Expression::executeSimpleExpressionExpansion(ExpressionContext& ctx,
}

builder.close();
mustDestroy = true;
return AqlValue(std::move(buffer)); // builder = dynamic data
mustDestroy = true; // builder = dynamic data
return AqlValue(std::move(buffer), rm);
}

// execute an expression of type ExpressionType::kSimple with ITERATOR
Expand Down
3 changes: 3 additions & 0 deletionsarangod/Aql/ExpressionContext.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,6 +32,7 @@ struct TRI_vocbase_t;

namespace arangodb {
struct ValidatorBase;
struct ResourceMonitor;
namespace transaction {
class Methods;
}
Expand DownExpand Up@@ -78,6 +79,8 @@ class ExpressionContext {

// unregister a temporary variable from the ExpressionContext.
virtual void clearVariable(Variable const* variable) noexcept = 0;

virtual ResourceMonitor* getResourceMonitorPtr() const noexcept = 0;
};
} // namespace aql
} // namespace arangodb
93 changes: 70 additions & 23 deletionsarangod/Aql/Function/ArrayFunctions.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,8 +25,10 @@
#include "Aql/AqlValueMaterializer.h"
#include "Aql/AstNode.h"
#include "Aql/ExpressionContext.h"
#include "Aql/ExecutorExpressionContext.h"
#include "Aql/Function.h"
#include "Aql/Functions.h"
#include "Aql/QueryExpressionContext.h"
#include "Aql/Range.h"
#include "Basics/Exceptions.h"
#include "Basics/VelocyPackHelper.h"
Expand DownExpand Up@@ -130,7 +132,9 @@ AqlValue functions::Push(ExpressionContext* expressionContext, AstNode const&,
builder->openArray();
builder->add(p);
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

if (!list.isArray()) {
Expand All@@ -157,7 +161,9 @@ AqlValue functions::Push(ExpressionContext* expressionContext, AstNode const&,
builder->add(p);
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function POP
Expand DownExpand Up@@ -192,7 +198,9 @@ AqlValue functions::Pop(ExpressionContext* expressionContext, AstNode const&,
iterator.next();
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function APPEND
Expand DownExpand Up@@ -268,7 +276,9 @@ AqlValue functions::Append(ExpressionContext* expressionContext, AstNode const&,
}
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function UNSHIFT
Expand DownExpand Up@@ -319,7 +329,9 @@ AqlValue functions::Unshift(ExpressionContext* expressionContext,
}
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function SHIFT
Expand DownExpand Up@@ -357,8 +369,9 @@ AqlValue functions::Shift(ExpressionContext* expressionContext, AstNode const&,
}
}
builder->close();
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size());
return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function REMOVE_VALUE
Expand DownExpand Up@@ -419,7 +432,9 @@ AqlValue functions::RemoveValue(ExpressionContext* expressionContext,
builder->add(it);
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function REMOVE_VALUES
Expand DownExpand Up@@ -463,7 +478,9 @@ AqlValue functions::RemoveValues(ExpressionContext* expressionContext,
}
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function REMOVE_NTH
Expand DownExpand Up@@ -514,7 +531,9 @@ AqlValue functions::RemoveNth(ExpressionContext* expressionContext,
cur++;
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function ReplaceNth
Expand DownExpand Up@@ -591,7 +610,9 @@ AqlValue functions::ReplaceNth(ExpressionContext* expressionContext,
builder->add(replaceValue);
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function POSITION
Expand DownExpand Up@@ -694,7 +715,9 @@ AqlValue functions::Interleave(aql::ExpressionContext* expressionContext,
}

builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function RANGE
Expand DownExpand Up@@ -748,7 +771,9 @@ AqlValue functions::Range(ExpressionContext* expressionContext, AstNode const&,
}
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function COUNT_DISTINCT
Expand DownExpand Up@@ -829,7 +854,9 @@ AqlValue functions::Unique(ExpressionContext* expressionContext, AstNode const&,
}

builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function SORTED_UNIQUE
Expand DownExpand Up@@ -868,7 +895,9 @@ AqlValue functions::SortedUnique(ExpressionContext* expressionContext,
builder->add(it);
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function SORTED
Expand DownExpand Up@@ -912,7 +941,9 @@ AqlValue functions::Sorted(ExpressionContext* expressionContext, AstNode const&,
}
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function UNION
Expand DownExpand Up@@ -955,7 +986,9 @@ AqlValue functions::Union(ExpressionContext* expressionContext, AstNode const&,
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
}

return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function UNION_DISTINCT
Expand DownExpand Up@@ -1015,7 +1048,9 @@ AqlValue functions::UnionDistinct(ExpressionContext* expressionContext,
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
}

return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function INTERSECTION
Expand DownExpand Up@@ -1087,7 +1122,9 @@ AqlValue functions::Intersection(ExpressionContext* expressionContext,
TRI_IF_FAILURE("AqlFunctions::OutOfMemory3") {
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
}
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function OUTERSECTION
Expand DownExpand Up@@ -1146,7 +1183,9 @@ AqlValue functions::Outersection(ExpressionContext* expressionContext,
TRI_IF_FAILURE("AqlFunctions::OutOfMemory3") {
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
}
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function FLATTEN
Expand DownExpand Up@@ -1185,7 +1224,9 @@ AqlValue functions::Flatten(ExpressionContext* expressionContext,
builder->openArray();
flattenList(listSlice, maxDepth, 0, *builder.get());
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function FIRST
Expand DownExpand Up@@ -1334,7 +1375,9 @@ AqlValue functions::Minus(ExpressionContext* expressionContext, AstNode const&,
builder->add(it.first);
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function Slice
Expand DownExpand Up@@ -1405,7 +1448,9 @@ AqlValue functions::Slice(ExpressionContext* expressionContext, AstNode const&,
}

builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = expressionContext->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

/// @brief function TO_ARRAY
Expand DownExpand Up@@ -1442,7 +1487,9 @@ AqlValue functions::ToArray(ExpressionContext* ctx, AstNode const&,
}
}
builder->close();
return AqlValue(builder->slice(), builder->size());
ResourceMonitor* rm = ctx->getResourceMonitorPtr();

return AqlValue(builder->slice(), builder->size(), rm);
}

} // namespace arangodb::aql
Loading

[8]ページ先頭

©2009-2025 Movatter.jp