adriangb commented on issue #28003: URL: https://github.com/apache/datafusion/issues/28003#issuecomment-7427977406
Example of "new state for producers in the recursive term" from [my comment above](https://github.com/apache/datafusion/issues/28003#issuecomment-7427448832): ```sql WITH RECURSIVE reach AS ( SELECT 1 AS node UNION SELECT e.dst FROM reach r JOIN edges e ON e.src = r.node ) SELECT * FROM reach ``` ``` RecursiveQueryExec ids renewed per iteration: {f1} └─ HashJoinExec producer: writes f1 ├─ WorkTableExec (reach) build side └─ DataSourceExec (edges) consumer: reads f1, src IN (...) TaskContext (query) ├─ iteration 1 child: f1 = src IN (1) ├─ iteration 2 child: f1 = src IN (2, 5) <- new slot, nothing stale └─ ... <- slot dropped with the child ``` - Today one shared filter object serves every iteration. Either iteration 2 sees stale bounds ([#26054](https://github.com/apache/datafusion/issues/26054)), or `reset_state` clears it in place, which breaks plan copies. - A producer outside the recursive term is not renewed, so all iterations read the parent slot. - Reusing state across iterations, such as the DuckDB example in [this comment](https://github.com/apache/datafusion/issues/28002#issuecomment-7407022540), means leaving that id out of the renewed set. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
