michaelsembwever commented on code in PR #24657: URL: https://github.com/apache/datafusion/pull/24657#discussion_r3945252347
########## datafusion/sqllogictest/test_files/dml_delete.slt: ########## @@ -200,3 +200,62 @@ SELECT * FROM test_delete_in; statement ok DROP TABLE test_delete_in; + +# Test DELETE with an IN or an EXISTS subquery in the WHERE clause +# The optimizer rewrites the subquery into a semi join, so the condition cannot +# reach the table provider as a filter. DataFusion rejects the statement instead +# of deleting every row. +statement ok +CREATE TABLE test_delete_subquery AS VALUES (1), (2), (3); + +statement ok +CREATE TABLE test_delete_subquery_src AS VALUES (2); + +statement error DataFusion error: This feature is not implemented: DELETE on table 'test_delete_subquery' with an IN or an EXISTS subquery in its WHERE clause is not supported +DELETE FROM test_delete_subquery WHERE column1 IN (SELECT column1 FROM test_delete_subquery_src); Review Comment: added a section to dml_delete.slt and dml_update.slt repeating every statement with the optimizer off. verifiying: - the subquery predicate reaches the provider and is rejected when the provider compiles it ( feature is not implemented: physical plan does not support logical expression InSubquery (and Exists)), - WHERE false and WHERE 1 = 2 reach the provider as predicates and match no row ( count = 0 ) -- 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]
