ryux1 commented on PR #25005:
URL: https://github.com/apache/datafusion/pull/25005#issuecomment-5714315660

   I reproduced this on the exact pre-fix parent, `d25ffaab4`, using the CLI 
and an in-memory table:
   
   ```sql
   create table t as values (1), (2), (3);
   delete from t limit 1; -- count = 3
   select * from t;       -- no rows
   
   create table u as values (1), (2), (3);
   delete from u where column1 > 1 limit 1; -- count = 2
   select * from u;                         -- only 1 remains
   ```
   
   The `Limit` is present in the DML input, as you noted. The loss happens 
later: the physical planner calls `extract_dml_filters(input, table_name)`, 
which traverses through `LogicalPlan::Limit` but returns only `Vec<Expr>`. It 
then calls `TableProvider::delete_from(session_state, filters)`, whose API has 
no limit argument. The memory provider therefore deletes every row matching 
those filters.
   
   So the planner input does retain the limit, but it cannot reach the 
provider. The rejection in this PR prevents the observed unbounded delete until 
bounded-delete semantics and a provider API for them are implemented.


-- 
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]

Reply via email to