michaelsembwever opened a new pull request, #24655: URL: https://github.com/apache/datafusion/pull/24655
## Which issue does this PR close? https://github.com/apache/datafusion/issues/24654 ## Rationale for this change ## What changes are included in this PR? `EXPLAIN DELETE` and `EXPLAIN UPDATE` changed the rows of a `MemTable`. `handle_explain()` builds the physical plan in order to print it, the physical planner calls the provider hook while it builds the plan, and `MemTable` did the whole row change inside the hook. The returned `DmlResultExec` was a constant node that only reported the count the hook had computed, so the plan text also carried the count. Replace `DmlResultExec` with `MemDmlExec`. The hook now compiles the `WHERE` clause and the assignments, then returns a plan that holds the partitions and the declared sort order of the table. `execute()` applies the operation, clears the sort order, and emits the count. This is the pattern that the provider guide already recommends, and `MemTable` is the reference implementation. Every check of the statement stays in the hook, so an `EXPLAIN` still reports an invalid statement. A plan that runs twice applies the operation twice, as `DataSinkExec` does for an INSERT. The `DmlResultExec: rows_affected=0` lines of `delete.slt` and `update.slt` become `MemDmlExec: op=Delete` and `MemDmlExec: op=Update`. The count is unknown while the plan is built, so it no longer appears in the plan text. ## Are these changes tested? Only with the tests here, which are based on the assumptions made in the issue. ## Are there any user-facing changes? -- 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]
