Repository navigation
Commit 8d744f8
fix: keep the output of a materialized CTE per run, not in the plan
`MaterializedCteExec::reset_state` cleared the shared buffer in place and returned `self`.
This did not follow the `ExecutionPlan::reset_state` contract, and two overlapping runs of one plan shared one buffer.
The buffered output is now in a new `RunState` of the `TaskContext`, keyed by the CTE id.
Each run of a plan has its own `TaskContext`, so each run has its own output.
The plan nodes keep no state of a run, so the default `reset_state` is correct for them.
`RecursiveQueryExec` gives each iteration a child `RunState` in which the CTEs that the recursive term declares have no output.
A CTE that is declared outside the recursive term keeps its output for the whole query.
Closes apache#26229.
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent 25f7d36 commit 8d744f8
2 files changed
Lines changed: 306 additions & 34 deletions
0 commit comments