hemanthboyina opened a new pull request, #60028:
URL: https://github.com/apache/spark/pull/60028

   **What changes were proposed in this pull request?**                         
                                                                                
                                         
                                                                                
                                                                                
                                              
   JDBCTable now implements SupportsDeleteV2. A DELETE with a supported WHERE 
condition is compiled and run as one DELETE statement on the database.          
                                                                                
                                      
                                                                                
                                                                                
                                              
   canDeleteWhere only accepts the delete if every predicate can be compiled. 
deleteWhere compiles the predicates, ANDs them, and runs the statement; an 
empty array deletes all rows. The condition is built with the existing 
JdbcDialect.compileExpression, the same path used for read pushdown.            
                                                                                
                                      
                                                                                
                                                                                
                                              
   Supported predicates: =, <>, <=>, <, <=, >, >=, IS NULL, IS NOT NULL, 
IN,AND/OR/NOT, with a single column compared to a literal. Supported literals 
are NULL, integral types, and decimals that don't render in scientific 
notation. Other conditions (functions, casts, subqueries, 
string/date/timestamp/float/boolean literals, etc.) are not compiled and fail 
during analysis as before.
   
   **Why are the changes needed?**                                              
                                                                                
                                         
                                                                                
                                                                                
                                              
   JDBCTable didn't support deletes, so any conditional DELETE on a JDBC table 
failed. Databases can run these deletes directly, so we push them down.
   
    **Does this PR introduce any user-facing change?**                          
                                                                                
                                        
                                                                                
                                                                                
                                              
   Yes. DELETE FROM a JDBC catalog table with a supported condition now works 
instead of throwing. Unsupported conditions behave as before.
   
    **How was this patch tested?**                                              
                                                                                
                                          
                                                                                
                                                                                
                                              
   JDBCV2Suite (H2), V2JDBCTest, DeleteFromTableSuiteBase
   
    **Was this patch authored or co-authored using generative AI tooling?** 
   Yes, Generated-by: Claude Opus 5.5
   


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