The scope of this PR is to implement build_query_plan and the top-level functions for the simple planning paths (no defer, and no mutations). After this PR, a call to build_query_plan should ideally hit a todo!() somewhere deeper inside the project, not at the top level. Some lifetime changes are required to existing code which is where most of the diff comes from.
planner.build_query_plan() can now run until we get to the processor stage (where the fetch dependency graph cost is calculated). I stopped there because processing is a big chunk of code that looks like it should be part of FED-62.
Notes on the changes to existing code:
Because we aren't working with owned selection sets in selection set merging in mutation operations, but with Arcs, I changed the existing selection merging in operation.rs to operate on references. This makes it more flexible. I also removed the ExactSizeIterator optimisation as I expect it's rare and I'd be surprised if it makes a difference (we should reintroduce if there is benchmarking to show that it helps).
PlanNode and TopLevelPlanNode now both use Boxes instead of Arcs, and the structures are exactly the same except for the additional Subscription stuff on TopLevelPlanNode. This makes it easier to convert between the two.
Everything else is part of the build_query_plan function.
I left a few questions in the code tagged with XXX(@) that i don't think need to be fully addressed in this review but would be nice to check in case.
The scope of this PR is to implement
build_query_plan
and the top-level functions for the simple planning paths (no defer, and no mutations). After this PR, a call tobuild_query_plan
should ideally hit atodo!()
somewhere deeper inside the project, not at the top level. Some lifetime changes are required to existing code which is where most of the diff comes from.planner.build_query_plan()
can now run until we get to the processor stage (where the fetch dependency graph cost is calculated). I stopped there because processing is a big chunk of code that looks like it should be part of FED-62.Notes on the changes to existing code:
Arc
s, I changed the existing selection merging in operation.rs to operate on references. This makes it more flexible. I also removed theExactSizeIterator
optimisation as I expect it's rare and I'd be surprised if it makes a difference (we should reintroduce if there is benchmarking to show that it helps).Box
es instead ofArc
s, and the structures are exactly the same except for the additional Subscription stuff on TopLevelPlanNode. This makes it easier to convert between the two.Everything else is part of the
build_query_plan
function.I left a few questions in the code tagged with
XXX(@)
that i don't think need to be fully addressed in this review but would be nice to check in case.