Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@knakatasf
Copy link
Contributor

@knakatasf knakatasf commented Nov 10, 2025

Scope & Purpose

  • Functions in ArrayFunctions.cpp return 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

  • Tests
    • Regression tests
    • C++ Unit tests
    • integration tests
    • resilience tests
  • 📖 CHANGELOG entry made
  • 📚 documentation written (release notes, API changes, ...)
  • Backports
    • Backport for 3.12.0: (Please link PR)
    • Backport for 3.11: (Please link PR)
    • Backport for 3.10: (Please link PR)

Related Information

(Please reference tickets / specification / other PRs etc)

  • Docs PR:
  • Enterprise PR:
  • GitHub issue / Jira ticket:
  • Design document:

Note

Array functions now extract ResourceMonitor from ExpressionContext and pass it to AqlValue constructors for supervised allocations.

  • AQL Array Functions:
    • Extract ResourceMonitor* from ExpressionContext (FixedVarExpressionContext or ExecutorExpressionContext) and pass it to returned AqlValue instances.
    • Updated functions include: 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.

@cla-bot cla-bot bot added the cla-signed label Nov 10, 2025
@knakatasf knakatasf changed the base branch from devel to feature/supervised-aql-value November 10, 2025 21:24
@knakatasf knakatasf marked this pull request as ready for review November 10, 2025 21:24
Copy link

@cursor cursor bot left a 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();
Copy link

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.

Fix in Cursor Fix in Web

AqlValue functions::Push(ExpressionContext* expressionContext, AstNode const&,
VPackFunctionParametersView parameters) {
auto* execCtx = dynamic_cast<FixedVarExpressionContext*>(expressionContext);
ResourceMonitor* rm = execCtx ? &execCtx->resourceMonitor() : nullptr;
Copy link

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().

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants