-
Notifications
You must be signed in to change notification settings - Fork 871
[SupervisedAqlValue] Make Array Functions' AqlValues Supervised #22087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/supervised-aql-value
Are you sure you want to change the base?
[SupervisedAqlValue] Make Array Functions' AqlValues Supervised #22087
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| /// @brief function TO_ARRAY | ||
| AqlValue functions::ToArray(ExpressionContext* ctx, AstNode const&, | ||
| VPackFunctionParametersView parameters) { | ||
| LOG_DEVEL << "ToArray: " << typeid(*ctx).name(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: AqlValue construction inconsistency causes resource monitoring issues.
The ToArray function doesn't extract and pass ResourceMonitor to the returned AqlValue, unlike all other functions in this file that construct AqlValue from builders. Line 1520 returns AqlValue(builder->slice(), builder->size()) without the third rm parameter, which is inconsistent with the PR's purpose and could cause resource monitoring issues.
| AqlValue functions::Push(ExpressionContext* expressionContext, AstNode const&, | ||
| VPackFunctionParametersView parameters) { | ||
| auto* execCtx = dynamic_cast<FixedVarExpressionContext*>(expressionContext); | ||
| ResourceMonitor* rm = execCtx ? &execCtx->resourceMonitor() : nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Casting Error Hides Resource Monitor
The dynamic_cast to FixedVarExpressionContext is overly restrictive and will fail for other valid QueryExpressionContext subclasses like DocumentExpressionContext, causing rm to be nullptr when the ResourceMonitor is actually available. The cast should target QueryExpressionContext instead, since that's the base class containing resourceMonitor().
Scope & Purpose
Functions in
ArrayFunctions.cppreturn AqlValue by calling ctor AqlValue(VPackSlice).Extract ResourceMonitor* from ExpressionContext of each function's parameter. They are FixedVarExpressionContext or ExecutorExpressionContext.
Pass ResourceMonitor* to the returned AqlValue.
💩 Bugfix
🍕 New feature
🔥 Performance improvement
🔨 Refactoring/simplification
Checklist
Related Information
(Please reference tickets / specification / other PRs etc)
Note
Array functions now extract ResourceMonitor from ExpressionContext and pass it to AqlValue constructors for supervised allocations.
ResourceMonitor*fromExpressionContext(FixedVarExpressionContextorExecutorExpressionContext) and pass it to returnedAqlValueinstances.PUSH,POP,APPEND,UNSHIFT,SHIFT,REMOVE_VALUE,REMOVE_VALUES,REMOVE_NTH,REPLACE_NTH,POSITION,INTERLEAVE,RANGE,COUNT_DISTINCT,UNIQUE,SORTED_UNIQUE,SORTED,UNION,UNION_DISTINCT,INTERSECTION,OUTERSECTION,FLATTEN,FIRST,LAST,NTH,MINUS,SLICE,TO_ARRAY.Written by Cursor Bugbot for commit 2d74f51. This will update automatically on new commits. Configure here.