Skip to content

WIP to move the operator children out of a vector#17568

Closed
taniabogatsch wants to merge 5 commits intoduckdb:mainfrom
taniabogatsch:linked-list-op
Closed

WIP to move the operator children out of a vector#17568
taniabogatsch wants to merge 5 commits intoduckdb:mainfrom
taniabogatsch:linked-list-op

Conversation

@taniabogatsch
Copy link
Contributor

As discussed with @Mytherin and @Maxxen, here is a first draft on a possible solution to move the operator children out of a vector.

I don't think this is pretty enough yet to go with it. Initially, I wanted to make no changes to the operator constructors and planning functions. However, since some operators push_back to their children in their constructors (instead of in the planning functions), I ended up passing the arena to those operators.

I think moving forward, we have three options to finish up this PR, with varying levels of prettiness.

  1. Intrusive linked list.

    • Plus, Max's and my favourite. We completely omit the arena, and also the ArenaLinkedList.
    • Downside, significant code changes.
  2. We do not store the arena in the ArenaLinkedList. Instead of push_back(elem), we add Append(arena, elem).

    • Plus, we solve the ugly Init situation, which currently has to sometimes happen in the constructors AND Make.
    • Downside, we need to pass the arena everywhere.
    • Downside, semantically, an ArenaLinkedList can have nodes from multiple arenas.
  3. We explicitly construct the ArenaLinkedList(ArenaAllocator &arena) in PhysicalOperator, instead of optionally initiliazing it.

    • Plus, we don't have to touch any push_back.
    • Downside, we need to pass the arena to every operator constructor. That's A LOT, and many of them have no children.

Let me know how to best move forward with this. :)

@taniabogatsch
Copy link
Contributor Author

Will close this and eventually re-open a PR implementing 3.

Mytherin added a commit that referenced this pull request Jun 12, 2025
Follow-up to #17568.

Construct the `ArenaLinkedList` with an `ArenaAllocator` (via `Make` in
the `PhysicalPlan`).

Found a few more places where we used `uniq_ptr` instead of a reference
for the `PhyscialOperator` (result collectors), so I also changed that
code.
@taniabogatsch taniabogatsch deleted the linked-list-op branch August 12, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants