Skip to content

Support nested execution in the planner #8

@Arachnid

Description

@Arachnid

If we do this via raw calls, it would work something like this:

  • Add accessors on the planner .state and .commands that return placeholder Value objects representing the executor state and the commands used by a nested instance.
  • Add a function on the planner .createSubplanner (or something). This function takes a FunctionCall, wraps it into a SubplanFunctionCall and puts it on the list of calls, then returns a new planner object initialised with the context of the parent.
  • When planning, if we encounter a SubplanFunctionCall, recurse and plan that call before continuing. Use the same internal state for tracking slot liveness etc, as the same state array will be used throughout all the nested calls.
  • When looking at function arguments and return values, if we encounter a StateValue, encode the special register ID for the state. If we encounter a CommandsValue and the current call is a SubplanFunctionCall, ABI-encode the the list of commands for that subplan and insert as a literal value into the state.
  • If we encounter a CommandsValue in a call that's not a SubplanFunctionCall, throw an error. If we encounter a SubplanFunctionCall that doesn't have a CommandsValue, throw an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions