@@ -359,6 +359,47 @@ async fn test_delete_compound_filters_with_pushdown() -> Result<()> {
359359 Ok ( ( ) )
360360}
361361
362+ #[ tokio:: test]
363+ async fn test_delete_mixed_filter_locations ( ) -> Result < ( ) > {
364+ // Test mixed-location filters: some in Filter node, some in TableScan.filters
365+ // This happens when provider uses TableProviderFilterPushDown::Inexact,
366+ // meaning it can push down some predicates but not others.
367+ let provider = Arc :: new ( CaptureDeleteProvider :: new_with_filter_pushdown (
368+ test_schema ( ) ,
369+ TableProviderFilterPushDown :: Inexact ,
370+ ) ) ;
371+ let ctx = SessionContext :: new ( ) ;
372+ ctx. register_table ( "t" , Arc :: clone ( & provider) as Arc < dyn TableProvider > ) ?;
373+
374+ // Execute DELETE with compound WHERE clause
375+ ctx. sql ( "DELETE FROM t WHERE id = 1 AND status = 'active'" )
376+ . await ?
377+ . collect ( )
378+ . await ?;
379+
380+ // Verify that both predicates are extracted and passed to delete_from(),
381+ // even though they may be split between Filter node and TableScan.filters
382+ let filters = provider
383+ . captured_filters ( )
384+ . expect ( "filters should be captured" ) ;
385+ assert_eq ! (
386+ filters. len( ) ,
387+ 2 ,
388+ "should extract both predicates (union of Filter and TableScan.filters)"
389+ ) ;
390+
391+ let filter_strs: Vec < String > = filters. iter ( ) . map ( |f| f. to_string ( ) ) . collect ( ) ;
392+ assert ! (
393+ filter_strs. iter( ) . any( |s| s. contains( "id" ) ) ,
394+ "should contain id filter"
395+ ) ;
396+ assert ! (
397+ filter_strs. iter( ) . any( |s| s. contains( "status" ) ) ,
398+ "should contain status filter"
399+ ) ;
400+ Ok ( ( ) )
401+ }
402+
362403#[ tokio:: test]
363404async fn test_update_assignments ( ) -> Result < ( ) > {
364405 let provider = Arc :: new ( CaptureUpdateProvider :: new ( test_schema ( ) ) ) ;
0 commit comments